A collection of handy one-liners and snippets by Paul Engel
bash -c 'source /path/to/your/.env; echo $MYENVVAR'| var mod, define; | |
| mod = (function() { | |
| 'use strict'; | |
| var modules = {}; | |
| return { | |
| define: function(name, mod) { | |
| modules[name] = (typeof(mod) == 'function') ? mod : function() { return mod; }; |
A collection of handy one-liners and snippets by Paul Engel
bash -c 'source /path/to/your/.env; echo $MYENVVAR'| require_relative "task" | |
| desc "Send an invite" | |
| task :invite do |name, email| | |
| puts "Invitation sent to '#{name} <#{email}>'" | |
| end | |
| # Example: | |
| # | |
| # $ rake invite "Paul Engel" [email protected] |
| def pretty_inspect(object, indent = 2) | |
| if object.is_a?(Array) | |
| entries = object.collect{|x| "#{pretty_inspect x, indent + 2}"} | |
| pretty_indent entries, "[", "]", indent | |
| elsif object.is_a?(Hash) | |
| entries = object.keys.sort.collect{|x| "#{pretty_inspect x} => #{pretty_inspect object[x], indent + 2}"} | |
| pretty_indent entries, "{", "}", indent | |
| else | |
| object.inspect | |
| end |
| function inspect(object) { | |
| switch (typeof(object)) { | |
| case "undefined": | |
| return "undefined"; | |
| case "string": | |
| return "\"" + object.replace(/\n/g, "\\n").replace(/\"/g, "\\\"") + "\""; | |
| case "object": | |
| if (object == null) { | |
| return "null"; | |
| } |
| function current_rvm_ruby { | |
| color=$(tput setaf 3) | |
| default=$(tput sgr0) | |
| version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') | |
| gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') | |
| [ "$gemset" != "" ] && gemset="@$gemset" | |
| full=${color}${version}${gemset}${default} | |
| [ "$full" != "" ] && echo "$full " | |
| } |
| =block | |
| display: block | |
| =clear | |
| *display: inline-block | |
| &:after | |
| content: " " | |
| height: 0 | |
| +block | |
| clear: both |