Skip to content

Instantly share code, notes, and snippets.

View isaacsu's full-sized avatar

Isaac Su isaacsu

View GitHub Profile
@isaacsu
isaacsu / tutorial.md
Created July 17, 2018 04:13 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@isaacsu
isaacsu / sim-distance.py
Created May 14, 2012 22:28
sim-distance in python
# Returns a distance-based similarity score for person1 and person2
def sim_distance(prefs,person1,person2):
# Get the list of shared_items
si={}
for item in prefs[person1]:
if item in prefs[person2]:
si[item]=1
# if they have no ratings in common, return 0
if len(si)==0: return 0
@isaacsu
isaacsu / sim-distance.clj
Created May 14, 2012 22:26
sim-distance in clojure
(defn sim-distance [critic1 critic2]
; work out movies that both critics have rated
(let [shared-movies
((fn [c1 c2]
(map #(first %) (filter #(c2 (first %)) c1))) critic1 critic2)]
; return 0 if they have no ratings in common
(if (= (count shared-movies) 0)
0
; compute distance
(/ 1 (+ 1 (reduce + (map #(expt (- (critic1 %) (critic2 %)) 2) shared-movies)))))))
@isaacsu
isaacsu / gatlinggun.php
Created February 18, 2012 06:05
Gatling Gun
<?php
/**
* Gatling gun takes an array of valid params and returns every
* combination of invalid data caused by blanking out individual params.
*
* Example:
*
* $validData = array('firstName' => 'Gatling', 'lastName' => 'Gun', 'age' => 12);
* $ggData = gatlingGun($validData);
*
@isaacsu
isaacsu / keybase.md
Created April 4, 2014 01:35
keybase.md

Keybase proof

I hereby claim:

  • I am isaacsu on github.
  • I am isaacsu (https://keybase.io/isaacsu) on keybase.
  • I have a public key whose fingerprint is 6A25 F38F 2BBF 1A98 98D5 D118 13E4 CCE5 4648 52C6

To claim this, I am signing this object: