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
$ go install github.com/c35s/hype@latest | |
# it'll take a few seconds to show the shell | |
$ hype -kernel https://cdn.c35s.co/bzImage-amd64 \ | |
-block https://cdn.c35s.co/ubuntu-amd64.squashfs \ | |
-cmdline "console=hvc0 reboot=t root=/dev/vda init=/bin/sh" |
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
@discardableResult func cons(_ x: Any, _ y: Any) -> (((Any, Any) -> Any) -> Any) { | |
return { m in m(x, y) } | |
} | |
@discardableResult func car(_ z: (((Any, Any) -> Any) -> Any)) -> Any { | |
return z { p, q in p } | |
} | |
@discardableResult func cdr(_ z: (((Any, Any) -> Any) -> Any)) -> Any { | |
return z { p, q in q } |
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
function gd { | |
local parent=$(dirname "$1") | |
local name=$(basename "$1") | |
local owner=$(basename "$parent") | |
local nwo="$owner/$name" | |
local dir="$HOME/src/$nwo" | |
[ -d "$dir" ] || git clone "https://github.com/$nwo" "$dir" | |
cd "$dir" |
A daily glance at what's happening in a high velocity codebase, thanks to @defunkt:
https://github.com/your/repo/compare/master@{yesterday}...master
Bookmark, share, and enjoy.
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
#ifndef __ID_H | |
#define __ID_H | |
struct __closure | |
{ | |
_imp_t method; | |
oop data; | |
}; | |
struct __lookup |
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
# The worst possible way to memoize something. | |
class X | |
def value | |
@value = really_expensive_operation | |
def value; @value end | |
@value | |
end | |
end |
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 Watchable | |
def events | |
@events ||= Hash.new { |h,k| h[k] = [] } | |
end | |
def fire event, *args | |
events[event].each { |e| e[*args] } | |
end | |
def on event, &block |
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
class ActiveRecord::Base | |
attr_accessible nil | |
def update_attributes *args | |
raise "Don't call #{self.class.name}#update_attributes. " + | |
"Mass assignment is pure evil." | |
end | |
end |
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
require "overlord/searchable" | |
module Overlord | |
# Mark an ActiveRecord model as having a state machine. Requires a | |
# string attribute called `state`. To set the default state for a | |
# class, set a default column value for `state` in the database. | |
# | |
# Use Symbols for all keys and values in state definitions. |
NewerOlder