This file contains hidden or 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 ruby -wKU | |
groups = %x(dscl . -list /Groups).split("\n") | |
gids = [] | |
groups.each do |group| | |
gids += [%x(dscl . -read /Groups/#{group} PrimaryGroupID).split[-1].to_i] | |
end | |
puts gids.sort |
This file contains hidden or 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 Paths | |
def self.method_names | |
@method_names ||= [] | |
end | |
module InstanceMethods | |
# Add your nested resources below | |
NESTED_ROUTES = { | |
:account => :payment | |
} |
This file contains hidden or 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
#!/opt/local/bin/bash | |
# .git/hooks/commit-msg | |
exec < /dev/tty | |
commit_message=$1 | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
branch=${ref#refs/heads/} | |
# Exit if commit message empty |
This file contains hidden or 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
a {-webkit-transition-duration: .33s; -webkit-transition-property: color, background;} | |
dl#sidebarlinks dd {-webkit-transition:-webkit-transform .33s linear} | |
dl#sidebarlinks dd:hover {-webkit-transform:rotate(-3deg);} |
This file contains hidden or 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(example). | |
-export([fac/1, mult/2]). | |
fac(1) -> | |
1; | |
fac(N) -> | |
N * fac(N - 1). | |
mult(X, Y) -> | |
X * Y. |
This file contains hidden or 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(list_length). | |
-export([list_length/1]). | |
list_length([]) -> | |
0; | |
list_length([First | Rest]) -> | |
1 + list_length(Rest). |
This file contains hidden or 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
A Few Examples of using Scripting Bridge: | |
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40006104-CH4-DontLinkElementID_12 | |
A note of Performance & Optimisation with Scripting Bridge: | |
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/ImproveScriptingBridgePerf/ImproveScriptingBridgePerf.html#//apple_ref/doc/uid/TP40006104-CH6-SW1 | |
NSAppleScript Technote/Example: | |
http://developer.apple.com/technotes/tn2006/tn2084.html |
This file contains hidden or 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
def foo(bar = {}) | |
if bar.any? | |
bar.keys | |
end | |
end |
This file contains hidden or 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
# exhibit a | |
{:conditions => case f.to_s | |
when 'active' then {:state => @@states[2]} | |
when 'disabled' then {:state => @@states[0..1]} | |
when 'all' then {} | |
else {:state => @@states[3]} | |
end} | |
# exhibit b | |
case f.to_s |
This file contains hidden or 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 ruby | |
require "find" | |
require "optparse" | |
require "rubygems" | |
require "session" | |
require "webby" | |
begin | |
require "inotify" |