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
# Usage is made of oranges and lemonade and lines starting with "##" | |
def usage | |
open(__FILE__).read.grep(/^## ?/).join.gsub(/^## ?/, '') | |
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
var colors = ['aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightsteelblue', 'lightyellow', 'lime |
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
# Fake `svnlook` for testing prupose. | |
# ./fake_svnlook.rb changed /home/pouet/blah/svn/kikoo -r 3483 | |
# ^-- will just read /tmp/fakeSvn.3483 :) | |
abort 'only the `changed` keyword is allowed on fake_svnlook' if ARGV[0] != 'changed' | |
abort 'only the `-r` option is supported on fake_svnlook' if ARGV[2] != '-r' | |
abort "svnlook: No such revision #{ARGV[3]}" unless File.exists?(fake_svn = "/tmp/fakeSvn.#{ARGV[3]}") | |
puts File.read(fake_svn) |
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/ruby | |
# AudreyRandom | |
# Randomly returns elements out of an enumerable, without picking previous elements. | |
# | |
# Author: Sunny Ripert - http://sunfox.org | |
# Licence: WTFPL | |
# | |
# You see, my ex-girlfriend used to blame her music player's random algorythm | |
# because it sometimes gave her a song which played just a few minutes ago. | |
# This is for you, Audrey ;). |
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
/* | |
* hash_change_listener(hash_check_interval) | |
* | |
* Prototype method for launching a "hash:change" custom event when the | |
* page's #anchor changes. | |
* | |
* Examples: adding a class to the current page anchor. | |
* | |
* document.observe('hash:change', function(event) { | |
* var div = $(window.location.hash.replace(/^#/, '')) |
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
# args_remove | |
# Simple way of taking out single arguments from ARGV if they match | |
# a given regexp. | |
# | |
# by Sunny Ripert under the WTFPL | |
# | |
# Example: | |
# | |
# if args_remove '--usage' | |
# puts "Usage: app [--progress] [--verbose] [-r|--recursive] [--days=N] [--tag=X --tag=Y...] files" |
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
# args_remove | |
# Simple way of taking out single arguments from ARGV if they match | |
# a given regexp. | |
# | |
# by Sunny Ripert under the WTFPL | |
# | |
# Example: | |
# | |
# if args_remove '--usage' | |
# puts "Usage: app [--progress] [--verbose] [-r|--recursive] [--days=N] [--tag=X --tag=Y...] files" |
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
class Array | |
def to_h(&block) | |
ary = block_given? ? self.collect(&block) : self | |
Hash[*ary.flatten] | |
end | |
end | |
class Hash | |
def to_h(&block) | |
return self if !block_given? |
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/ruby | |
# Dirstat by Sunny Ripert <[email protected]> | |
# Provides useful file-usage statistics on a given directory. | |
# | |
# Example: | |
# | |
# $ ruby dirstat.rb . | |
# directory %use files %use(graph) size | |
# -------------------------------------------------------------------------------- | |
# ./Futurama 56.11 % ( 27 files) |########### | 4.58GB |
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
class String | |
# ANSI-colored version of the string | |
def colorize(color) | |
n = case color | |
when :black: 30 | |
when :red: 31 | |
when :green: 32 | |
when :yellow: 33 | |
when :blue: 34 | |
when :magenta: 35 |
OlderNewer