Skip to content

Instantly share code, notes, and snippets.

View atroche's full-sized avatar

Alistair Roche atroche

View GitHub Profile
(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.
@atroche
atroche / phpclient
Created June 5, 2015 06:57
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 Ruby and JS. 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, and it shows — we've had feedback from partners that it's hard to use, and hard to contribute to.
This sucks. Not only are we causing real developers real pain every day, but we're being wimps: **real programmers are polyglot programmers**. Using a different language is just a design constraint, and as everyone knows, constraints lead to creativity.
@atroche
atroche / php.md
Last active August 29, 2015 14:22
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 Ruby and JS. 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, and it shows — we've had feedback from partners that it's hard to use, and hard to contribute to.

This sucks. Not only are we causing real developers real pain every day, but we're being wimps: real programmers are polyglot programmers. Using a different language is just a design constraint, and as everyone knows, constraints lead to creativity.

(d/q '[:find ?e :where [?e :employee/name]]
@conn)
=> #{[17592186045449] [3] [17592186045447] [17592186045443] [17592186045445]}
(d/q '[:find ?e
:where [?e :employee/name] [?e :employee/new]]
@conn)
=> #{[3]}
(d/q '[:find ?e
<html>
<head>
<link rel="icon" href="favicon.png">
</head>
<body>
hello katherine
</body>
</html>
;; helpers for finding fn arity at runtime via reflection
;; via http://stackoverflow.com/a/20312211
(defn provided
[cond fun x]
(if cond
(fun x)
x))
(defn append
[xs x]
(ns scratch.core
(:require [clojure.spec :as s]
[clojure.test.check.generators :as gen]
[clojure.core.logic :as cl]
[clojure.core.logic.fd :as fd]))
;; an attempt to generate the intervals between beeps in EquaTalk:
;; http://mason.gmu.edu/~rhanson/equatalk.html
(s/def ::beep-interval