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
#switch default editor for pry to sublime text | |
Pry.config.editor = "sublime" | |
#format prompt to be <Rails version>@<ruby version>(<object>)> | |
Pry.config.prompt = proc do |obj, level, _| | |
prompt = "\e[1;30m" | |
prompt << "#{Rails.version} @ " if defined?(Rails) | |
prompt << "#{RUBY_VERSION}" | |
"#{prompt} (#{obj})>\e[0m" | |
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
# switch default editor for pry to sublime text | |
Pry.config.editor = "subl" | |
# format prompt to be <Rails version>@<ruby version>(<object>)> | |
Pry.config.prompt = proc do |obj, level, _| | |
prompt = "\e[1;30m" | |
prompt << "#{Rails.version} @ " if defined?(Rails) | |
prompt << "#{RUBY_VERSION}" | |
"#{prompt} (#{obj}:#{level})>\e[0m" | |
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
.ir { | |
border:0; | |
font: 0/0 a; | |
text-shadow: none; | |
color: transparent; | |
background-color: transparent; | |
} |
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
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind. | |
// Hat tip Paul Irish | |
var o = $( {} ); | |
$.subscribe = o.on.bind(o); | |
$.unsubscribe = o.off.bind(o); | |
$.publish = o.trigger.bind(o); |
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
git push -f origin HEAD^:master |
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
// Partial size grid additions | |
// I have found sometimes I need partial spans (e.g. put two fields evenly below a span3 element) | |
// This now generates all spans, even though span4half is the same as span2. It is helpful when generating a page | |
// and you need to have half of an arbitrary span. | |
#gridExtended { | |
.core (@gridColumnWidth, @gridGutterWidth) { | |
// | |
// Partial spans | |
// |
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
def self.circle_path(center, radius, complete_path = false) | |
# For increased accuracy, if your data is in a localized area, add the elevation in meters to r_e below: | |
r_e = 6378137.0 | |
@@d2r ||= Math::PI/180 | |
@@multipliers ||= begin | |
segments = 16 | |
dRad = 2*Math::PI/segments | |
(segments + (complete_path ? 1 : 0)).times.map do |i| | |
rads = dRad*i | |
y = Math.sin(rads) |
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
Array.prototype.unique = function() { | |
var o = {}, i, l = this.length, r = []; | |
for(i=0; i<l;i+=1) o[this[i]] = this[i]; | |
for(i in o) r.push(o[i]); | |
return r; | |
}; | |
Array.prototype.values_at = function() { | |
var o = [], i, l = arguments.length; | |
for(i=0; i<l;i+=1) o.push( this[arguments[i]] ); |
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 capdu { | |
if [ -z "$1" ] | |
then | |
FILES=`gst | grep modified: | ruby -e 'puts ARGF.map {|l| l.split()[2]}.join(",")' | xargs echo` | |
else | |
FILES=`gst | grep modified: | grep $1 | ruby -e 'puts ARGF.map {|l| l.split()[2]}.join(",")' | xargs echo` | |
fi | |
if [ -z "$FILES" ] | |
then | |
echo "No modified files exist" |
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 BootstrapHelper | |
def bootstrap_best_in_place_if(condition, object, field, options = {}) | |
content_tag(:div, class: "control-group string optional #{options.delete(:wrapper_class)}".strip) do | |
label_tag(field, options.delete(:label), class: 'string optional control-label') + | |
content_tag(:div, class: 'controls') do | |
best_in_place_if condition, object, field, options | |
end | |
end | |
end |
OlderNewer