start new:
tmux
start new with session name:
tmux new -s myname
| # Create a new table called `globals | |
| :ets.new(:globals, [:named_table, :public]) | |
| # Put some data in it | |
| :ets.insert(:globals, {:are_we_crunching, true}) | |
| # Get it back | |
| :ets.lookup(:globals, :are_we_crunching) # true |
| function countCSSRules() { | |
| var results = '', | |
| log = ''; | |
| if (!document.styleSheets) { | |
| return; | |
| } | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| countSheet(document.styleSheets[i]); | |
| } | |
| function countSheet(sheet) { |
| // `unit` is `return` from Haskell | |
| // `bind` is `>>=` from Haskell, or `flatMap` from Scala | |
| var None = { | |
| bind: function (fn) { return this; }, | |
| unit: function (v) { return Option(v); }, | |
| getOrElse: function (elseValue) { return elseValue; } | |
| }; | |
| var Some = function (value) { |
| [alias] | |
| co = checkout | |
| st = status | |
| rso = remote show origin | |
| # e.g. git graphviz --first-parent master | dotty /dev/stdin | |
| graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f" | |
| # Pretty log | |
| lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
| # Print out all commits whose hash starts with a given string | |
| abbr = "!sh -c 'git rev-list --all | grep ^$1 | while read commit; do git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' -" |
| class ObjectPrinter | |
| #changed param name to item so it's clearer we're sticking an "item" in there and not the class "ObjectPrinter" itself | |
| def print_methods(item) | |
| #added a little space and header to make it easier to read | |
| 3.times {puts ""} | |
| puts "#{item} methods:" | |
| puts "----------------------------" | |
| puts "" |