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
puts "Hello world :)" |
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
#!/bin/sh -e | |
### BEGIN INIT INFO | |
# Provides: starling | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/stop starling server | |
### END INIT INFO | |
# | |
# starling This init.d script is used to start starling. | |
# It basically just calls starling. |
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 'rubygems' | |
require 'hpricot' | |
require 'iconv' | |
require 'time' | |
require 'builder' | |
require 'active_support/ordered_hash' | |
include ActiveSupport | |
THAI_MONTHS = [nil] + %w(มกราคม กุมภาพันธ์ มีนาคม เมษายน พฤษภาคม มิถุนายน กรกฎาคม สิงหาคม กันยายน ตุลาคม พฤษจิกายน ธันวาคม) |
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
# string_format_with_strftime_extension.rb | |
# | |
# Provide extension for String's % method to call Time%strftime when given argument | |
# is a Time object. So we can do <tt>"%d/%m/%Y" % Time.now</tt> and get the same | |
# result as <tt>Time.now.strftime "%d/%m/%Y"</tt> | |
# | |
# Put this file in #{RAILS_ROOT}/config/initializers so it will be automatically loaded. | |
class String | |
alias_method :format_without_strftime_extension, :% |
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
e() { | |
TMPROJ=`ls -1 *.tmproj 2>/dev/null` | |
if [ ! $TMPROJ = "" ]; then | |
osascript -e "tell application \"TextMate\" | |
open \"${PWD}/${TMPROJ}\" | |
activate | |
end tell" | |
else if [ "$1" = "" ]; then | |
mate "." | |
else |
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 'rubygems' | |
require 'active_support' | |
numbers = "%04d" % rand(9999) | |
available_colors = %w(#FF0080 #0080FF #408000 #FF8000 #FF6666 #6666FF #FF6FCF #800080 #FFCC66 #0000FF #FF0000) | |
colors = available_colors.shuffle[0,5] | |
y_points = [rand(10) + 20, rand(20), rand(20) + 30, rand(10) + 25, rand(20) + 15, rand(20) + 20] | |
`convert -size 135x50 xc:white \ | |
-fill "#{colors[0]}" -stroke "#{colors[0]}" -strokewidth 1 -family TimesNewRoman -pointsize #{rand(25) + 25} \ |
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 set_cookie(request, options) | |
if request.cookie_jar[@key] != options[:value] || !options[:expires].nil? | |
request.cookie_jar[@key] = options | |
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
" Highlight Ruby 1.8.x hash rocket | |
" This will prevent you to ever write it again | |
highlight ObsoleteHashRocket ctermbg=red guibg=red | |
au ColorScheme * highlight ObsoleteHashRocket guibg=red | |
au BufEnter * match ObsoleteHashRocket /=>/ | |
au InsertEnter * match ObsoleteHashRocket /=>/ | |
au InsertLeave * match ObsoleteHashRocket /=>/ |
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 'benchmark' | |
class A0 | |
def foo | |
true | |
end | |
end | |
(1..1000).each do |n| | |
eval <<-RUBY |
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
tar xzfO {package}.gem metadata.gz | gzcat | grep -q '\- =' && echo "Invalid" |
OlderNewer