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
import Darwin | |
public func arc4random <T: IntegerLiteralConvertible> (type: T.Type) -> T { | |
var r: T = 0 | |
arc4random_buf(&r, UInt(sizeof(T))) | |
return r | |
} | |
public extension UInt { | |
public static func random(lower: UInt = min, upper: UInt = max) -> UInt { |
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
import Cocoa | |
class GeneralThing<S> { | |
var stuff: S? | |
func doIt() { | |
if let s = stuff { | |
doWithStuff(s) | |
} | |
} |
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
APP_NAME := my_awesome_app | |
all: compile | |
compile: clear | |
@cp src/$(APP_NAME).app ebin/ | |
@erlc -pa ebin/ -o ebin/ src/*.erl | |
compile_test: compile | |
@erlc -pa ebin/ -o ebin/ test/*.erl |
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
#!/usr/bin/env bash | |
# Kill an Erlang process by node name | |
# | |
# e.g.: kill-erlang-node kred | |
# Check usage | |
if [ -z "$1" ]; then | |
echo "Usage: `basename $0` NODE_NAME" | |
exit 1 |
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
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- | |
%% ex: ts=4 sw=4 et | |
%% @author Kevin Smith <kevin@opscode.com> | |
%% @copyright 2011 Opscode, Inc. | |
-module(example). | |
-behaviour(gen_server). | |
-export([start_link/0]). |
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
-module(mymodule). | |
start_link() -> | |
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). | |
... | |
crash() -> | |
gen_server:cast(?MODULE, crash). | |
... | |
handle_cast(crash,State) -> | |
{stop, error, State}; | |
... |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
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
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |