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 'set' | |
# Let's provide a default to_proc in terms of threequals | |
class Object | |
def to_proc | |
method(:===).to_proc | |
end | |
end | |
class Set |
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
Faraday.new(site, request: { timeout: 30 }) |
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 Proc | |
def compose(g) | |
proc { |*args, &blk| call(g.call(*args, &blk)) } | |
end | |
end | |
symbolize = ->(x) { x.to_sym } | |
upcase = ->(x) { x.upcase } | |
symbolize_and_upcase = symbolize.compose(upcase) |
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_VERSION=`git --version | awk '{print $3}'` | |
curl -O http://www.kernel.org/pub/software/scm/git/git-manpages-${GIT_VERSION}.tar.bz2 | |
sudo tar xjv -C /usr/local/share/man -f git-manpages-${GIT_VERSION}.tar.bz2 |
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
$COMMAND_WITH_OUTPUT_TO_SUPPRESS >/dev/null 2>&1 |
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
find /path_to_search -type f -name "*the_pattern*" -exec rm {} \; |
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 tests to skip on Solaris Nevada (mainly iconv-related). | |
make test GIT_SKIP_TESTS='t3900 t3901 t5100 t9301' |
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 Object | |
# Test if the object is an integer. | |
# | |
# "54".is_i? #=> true | |
# "54_000".is_i? #=> true | |
def is_i? | |
!!Integer(self) rescue false | |
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
#!/usr/bin/env ruby | |
gems = {} | |
`gem dependency -R`.split("\n\n").each do |gem| | |
unless gem["Used by"] | |
version = gem[/\d+\.\d+\.\d+$/] | |
name = gem[4..-1][/^.*(?=-\d\.)/] | |
(gems[name] ||= []) << version | |
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
/* Parser for the jQuery Tablesorter Plugin to sort European dates, e.g. 30/02/08 */ | |
$.tablesorter.addParser({ | |
id: 'dates', | |
is: function(s) { return false }, | |
format: function(s) { | |
var dateArray = s.split('/'); | |
return "20" + dateArray[2] + dateArray[1] + dateArray[0]; | |
}, | |
type: 'numeric' | |
}); |