Skip to content

Instantly share code, notes, and snippets.

View jeremytregunna's full-sized avatar

Jeremy Tregunna jeremytregunna

View GitHub Profile
#include <iostream>
using namespace std;
template<class X> using Maybe = std::unique_ptr<X>;
template<class X> Maybe<X> Just(const X& x)
{
return Maybe<X>( new X(x) );
}
use std::comm;
use std::io::net::ip;
use std::io::net::tcp;
//use extra::uv;
use std::comm;
use std::io;
use std::result;
use std::task;
type ConnectMsg = (tcp::TcpNewConnection, comm::channel<Option<tcp::TcpErrData>>);
# Heavy State Sync
require 'faye/websocket'
require 'json'
class HeavyStateSync
KEEPALIVE_INTERVAL = 15
def initialize(app)
@app = app
#!/bin/sh
. git-simple-common.sh
if [ X"$1" = X"-h" ]; then
echo "Usage: git switch [branch]"
echo " Performs an optional stash of current changes before switching to [branch] where it"
echo " checks for any stashes that can be popped, and applies those."
exit 0
fi
#!/bin/zsh
if [ X"$1" = X"-h" ]; then
echo "Usage: git grab [remote]"
echo " Fetches changes from the supplied remote, or origin if omitted and rebases changes"
echo " onto your branch."
exit 0
fi
REMOTE=$1
public func memoize<T: Hashable, U>(body: ((T) -> U, T) -> U) -> (T) -> U {
var memo = Dictionary<T, U>()
var result: ((T) -> U)!
result = { x in
if let q = memo[x] {
return q
}
let r = body(result, x)
memo[x] = r
return r
KEYWORDS="TODO:|FIXME:|DevTeam:|XXX:|QRKPending"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -o -prune Pods \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
#import "Super.h"
@interface A : Super
- (instancetype)initWithMagic __attribute__((unavailable("Invoke the designated initializer `initWithPuppies` instead.")))
- (instancetype)initWithPuppies;
@end
//
// SFGCollagePreparer.m
// SFG
//
// Created by Jeremy Tregunna on 2015-07-16.
// Copyright (c) 2015 Shutterfly. All rights reserved.
//
#import "SFGCollagePreparer.h"
#import "SFGAreaOfInterest.h"
@jeremytregunna
jeremytregunna / AST manipulation.md
Created August 21, 2015 14:57
Modifying the AST, at compile time only in a dynamic interpreted language.

Requirement

Ability to implement complex syntactic constructs that otherwise might not be possible in an arbitrary language.

Tools

  • Ruby

Potential Issues