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 = :foo | |
| %w(a b c).each do |var| | |
| # Do something. | |
| end | |
| puts var # var is actually "c", not :foo. This is not a problem in Ruby 1.9 onwards. |
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
| jQuery.fn.bind = function (bind) { | |
| return function () { | |
| console.count("jQuery bind count"); | |
| console.log("jQuery bind %o", this); | |
| return bind.apply(this, arguments); | |
| }; | |
| }(jQuery.fn.bind); |
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
| # Put this in nrpe.cfg on the remote host you're monitoring. | |
| command[check_load]=/usr/local/nagios/libexec/check_load -w 5,4,3 -c 10,8,6 | |
| command[check_memory]=/usr/local/nagios/libexec/check_mem.pl -f -w 5 -c 2 | |
| command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p / | |
| command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10% | |
| command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z | |
| command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 | |
| command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10 |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Colors</key> | |
| <dict> | |
| <key>Background</key> | |
| <string>0.082 0.087 0.109</string> | |
| <key>InsertionPoint</key> | |
| <string>1.000 1.000 1.000</string> |
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
| #!/bin/sh | |
| set -u | |
| set -e | |
| APP_ROOT=/var/railsapps/ryokan/current | |
| PID=$APP_ROOT/tmp/pids/unicorn.pid | |
| ENV=production | |
| CMD="/opt/ruby-enterprise/bin/unicorn_rails -D -E $ENV -c config/unicorn.rb" | |
| old_pid="$PID.oldbin" |
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
| namespace :bundler do | |
| task :create_symlink, :roles => :app do | |
| set :bundle_dir, File.join(release_path, 'vendor', 'bundle') | |
| shared_dir = File.join(shared_path, 'bundle') | |
| run "rm -rf #{bundle_dir}" | |
| run "mkdir -p #{shared_dir} && ln -s #{shared_dir} #{bundle_dir}" | |
| end | |
| task :bundle_new_release, :roles => :app do |
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 $target = $('#selector'); | |
| var target_width = $target.parent(':first').width(); | |
| var $span = $('<span></span>'); | |
| $span.css({ | |
| 'display': 'inline', | |
| 'visibility': 'hidden', | |
| 'font-size': parseInt($target.css('font-size'), 10), | |
| 'font-weight': $target.css('font-weight'), | |
| 'white-space': 'nowrap' |
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
| //= require jquery | |
| //= require js/with/utf-8-characters |
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
| #!/bin/bash | |
| # Creates a swapfile at SWAPFILE. | |
| SWAPFILE=/mnt/swapfile | |
| SWAPSIZE_MB=7168 | |
| SWAP_ALREADY_ON=`swapon -s | grep $SWAPFILE` | |
| if [ -e $SWAPFILE ]; then | |
| if [[ -n $SWAP_ALREADY_ON ]]; then |
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
| ec2-run-instances ami-2c22637e --group default --key chuyeow --user-data hostname=hostname --instance-type c1.xlarge --region ap-southeast-1 --availability-zone ap-southeast-1a --disable-api-termination --monitor -b /dev/sda1=:30:false -b "/dev/sdb=ephemeral0" -b "/dev/sdc=ephemeral1" -b "/dev/sdd=ephemeral2" -b "/dev/sde=ephemeral3" |