Skip to content

Instantly share code, notes, and snippets.

View atroche's full-sized avatar

Alistair Roche atroche

View GitHub Profile
My pocket vibrated. I pulled my phone out and saw a name I hadn't seen in a long time. I sat up in bed, hesitating for a moment, trying to build up enthusiasm. I hated taking unexpected calls. I swiped.
“Holy shit, Anthony! How are you?” It was the ex-editor of PC PowerPlay, a magazine I'd freelanced for, years ago.
“I'm well, and you?”
“I'm good!” It was an old joke we had — he was a stickler for the Queen's English. He sounded the same as always, like an Australian Professor Frink. “How's … Canberra?” He'd been writing technical documentation for the government since he got fired.
He chuckled, to show he appreciated the effort. “Listen, Ali, I've been playing this game. Play-testing it for an American company, and it's … amazing.”
traceroute to koding.com (68.68.97.41), 64 hops max, 52 byte packets
1 192.168.1.1 (192.168.1.1) 4.468 ms 1.066 ms 0.981 ms
2 lo0.mel-cam-bng1.iinet.net.au (203.215.15.252) 22.625 ms 20.175 ms 17.112 ms
3 po-11.mel-cam-bdr1.iinet.net.au (203.215.15.4) 16.981 ms
po-11.mel-cam-bdr2.iinet.net.au (203.215.15.6) 17.633 ms
po-11.mel-cam-bdr1.iinet.net.au (203.215.15.4) 16.916 ms
4 te7-3.mel-pipe-bdr2.on.ii.net (203.215.20.48) 42.907 ms
te1-2.mel-cam-bdr2.on.ii.net (203.215.20.51) 17.064 ms
te7-3.mel-pipe-bdr2.on.ii.net (203.215.20.48) 16.688 ms
5 te7-3.mel-pipe-bdr2.on.ii.net (203.215.20.48) 17.543 ms
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'';';'''''''''''''''''''';;;;;;;;;;;;;;;;;;;;;;::::::,,,,,,,........
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;';'''''''''''''''''''''';;;;;;;;;;;;'''''';;;::::::,,,,,,,,,......
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'''''''''''''''''''''''';;;;''''';'''''''''';;;;:::::,,,,,,,,......
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;';';'''''''''''''''+''''+;';;'''''''''''''++++'';;;;:::::,,,,,,,,,....
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;''''''''''`;'''.:;''# ,''''''''''''''++++++'';;;;::::::,,,,,,,,...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;';''''''''''. '++:,;''+ .:;''''''''''''++++++++''';;;;::::,,,,,,,,,,.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;';';;;;'''++'#';++'';+++ ,:;+'++'''''''''''+++++++'';;;;:::::,,,,,,,,,
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::'''''++++++++++++++;'+'+'++++''';''''''''++++#++''';;;;:::::,,,,,,,
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;';;''';'..'++++++++++++++' `+++++++++';;:;;''''''''+++++++'';;;;:::::,,,,,,
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'''''''''''';;+++++++
require 'rubyperf'
m = Perf::Meter.new
result2=m.measure(:bang) do
10000000.times do
"asdf".sub!(/a/, "")
end
end
result1=m.measure(:non_bang) do
10000000.times do
(ann tuples-to-map [(Vec Any) -> (Map Any Any)])
(defn tuples-to-map [tuples]
(into {} tuples))
// Underscore.js 1.5.2
// http://underscorejs.org
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.5.2";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return};j.map=j.collect=
(defn valid-ticket-field [ticket-field]
(and (:active ticket-field)
(not (field-types-to-ignore (:type ticket-field)))))
(defn valid-ticket-field [{:keys [active type]}]
(and active
(not (field-types-to-ignore type))))
var fields = ['id', 'name', 'tags'],
fieldOrgs = fields.map(function(field){
return ticketOrg[field];
});
this.storage.user.organization = _.object(_.zip(fields, fieldOrgs));
This application displays a list of things the user should do (tasks). It allows the user to add tasks to the list, delete them or mark them as done.
To add a task to a list, the user types the name of their task into an input box and clicks a button or hits enter. When they do this, the input box becomes blank again, and the item appears at the top of the list.
Each task in the list shows:
the name of the task
a checkbox to mark it as done or not done
a button to delete the task from the list
when the done checkbox is checked, the todo is marked as done by making the name of the task appear with a line through it, and making the checkbox checked. same goes for unchecking it.
@atroche
atroche / php-client-blog
Created June 5, 2015 06:55
PHP client blog post
# Giving our PHP client some love
At Zendesk we're principally a Ruby and JavaScript shop. Our data team in Melbourne uses Clojure, and some of the infrastructure team in Dublin use Go, but everyone else sticks to those languages. And no one wants to do PHP.
Which is a problem, because the world uses PHP. A lot. And they want to have their Magento stores and their WordPress plugins interact with Zendesk.
We have a PHP API client, but it was written by an external contractor years ago, and hasn't been actively maintained since then. Bugs and new features have been added on in a slapdash fashion since then, and it shows — we've had feedback from partners that it's hard to use, and hard to contribute to.
This sucks. Real programmers are polyglot programmers. Using a different language is just a design constraint, and as everyone knows, constraints lead to creativity.