Skip to content

Instantly share code, notes, and snippets.

{
"jsonGraph": {
"organization": {
"facebook": {
"repositoriesWithCursor": {
"0": {
"$type": "ref",
"value": [
"repository",
"facebook/codemod"
query {
organization16j31a7:organization(id: "facebook") {
description,
id,
name
},
repository1awoa9m:repository(id: "facebook/react") {
description,
id,
name
var db = new PortalContext();
var profile = new Profile()
{
Id = 20,
FirstName = "Tyler",
LastName = "Durden"
};
db.Entry(profile).State = EntityState.Modified;
// scala
// adding interfaces to classes
trait Greetable {
def Greeting: String
}
def greet(g: Greetable): Unit = {
println(g.Greeting)
}
var account = (function(startingBalance) {
var balance = startingBalance;
function getBalance() {
return balance;
}
function deposit(amount) {
balance += amount;
[3,5].map { |n| n.step(max, n).to_a }.reduce(:|).reduce(0,:+)
type Greeting = () => String
def greet(g: Greeting) = {
println(g())
}
def hello() = { "hello from Huey" }
greet(hello) // >> "hello from Huey"
@eyston
eyston / gist:1257990
Created October 2, 2011 21:30
FSharp Interactive Textmate Command
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
// possibly tail recursive :p
open System.IO
// Seq.toList because I don't know how to pattern match an empty sequence :)
let folderWithDepth' path depth =
try
System.IO.Directory.EnumerateDirectories(path) |> Seq.toList |> List.map (fun d -> (d, depth))
with
| _ -> []
// controller
[CanViewProfile]
public ActionResult Show(int id)
{
var view = new ShowProfileQuery(id).Execute();
return View(view);
}
// before filter