View gist:1257990
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPR="$(cat | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')" | |
export SHELL_NAME=${SHELL_NAME:="FSharp Interactive"} | |
export SHELL_INTERPRETER=${SHELL_INTERPRETER:="fsi"} | |
osascript << END | |
tell application "Terminal" | |
activate | |
set _foundTab to false |
View gist:1276743
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Greeting = () => String | |
def greet(g: Greeting) = { | |
println(g()) | |
} | |
def hello() = { "hello from Huey" } | |
greet(hello) // >> "hello from Huey" |
View gist:1651135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[3,5].map { |n| n.step(max, n).to_a }.reduce(:|).reduce(0,:+) |
View gist:1701339
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var account = (function(startingBalance) { | |
var balance = startingBalance; | |
function getBalance() { | |
return balance; | |
} | |
function deposit(amount) { | |
balance += amount; |
View gist:2011848
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// scala | |
// adding interfaces to classes | |
trait Greetable { | |
def Greeting: String | |
} | |
def greet(g: Greetable): Unit = { | |
println(g.Greeting) | |
} |
View gist:2296834
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = new PortalContext(); | |
var profile = new Profile() | |
{ | |
Id = 20, | |
FirstName = "Tyler", | |
LastName = "Durden" | |
}; | |
db.Entry(profile).State = EntityState.Modified; |
View query.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query { | |
organization16j31a7:organization(id: "facebook") { | |
description, | |
id, | |
name | |
}, | |
repository1awoa9m:repository(id: "facebook/react") { | |
description, | |
id, | |
name |
View jsonGraph.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"jsonGraph": { | |
"organization": { | |
"facebook": { | |
"repositoriesWithCursor": { | |
"0": { | |
"$type": "ref", | |
"value": [ | |
"repository", | |
"facebook/codemod" |
View auth.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hasRole = (role, next) => { | |
return (obj, args, ctx) => { | |
if (ctx.rootValue.user.hasRole(role)) { | |
next(obj, args, ctx); | |
} else { | |
return null; | |
} | |
} | |
} |
View 1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rootValue = { | |
user, | |
client, | |
...root, | |
__timing: [] // store the timing info in here -- sorta hacky! | |
} | |
return graphql(schema, query, rootValue, variables).then(response => { |