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
cd ~/.rvm | |
rm `find . -type f -name test.log` | |
rm `find . -type f -name development.log` |
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
# open a gem in sublime text | |
opengem(){ | |
gempath=`gem which $1` | |
if [ ! -z $gempath ]; then | |
slt "$gempath/../.." | |
fi | |
} |
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
Ext.define('p7_ui_static.view.field.PaddedNumber', { | |
extend: 'Ext.form.field.Number', | |
alias: 'widget.paddednumberfield', | |
/** | |
* @cfg {Number} zeroPadding | |
* Number of digits to pad | |
* Defaults to 2 | |
*/ | |
zeroPadding: 2, |
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 | |
# Usage: | |
# ksdiffdir.rb /path/to/a /path/to/b | |
FOLDER_A = ARGV[0] | |
FOLDER_B = ARGV[1] | |
def build_file_list(dir_path) | |
Dir.glob("#{dir_path}/**/*").select{ |f| File.file?(f) }.collect{ |f| f.gsub("#{dir_path}", '') } |
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 FizzBuzz | |
refine Fixnum do | |
def to_s | |
if self % 3 == 0 && self % 5 == 0 | |
"FizzBuzz" | |
elsif self % 3 == 0 | |
"Fizz" | |
elsif self % 5 == 0 | |
"Buzz" | |
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
# openssl (homebrew) | |
brew update | |
brew install openssl | |
# ruby 2.0 | |
curl -O ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.bz2 | |
tar -xvf ruby-2.0.0-p0.tar.bz2 | |
cd ruby-2.0.0-p0 | |
./configure --with-opt-dir=`brew --prefix openssl` | |
make |
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 IPAddr | |
def is_private? | |
return between?('172.16.0.0','172.31.255.255') || between?('10.0.0.0','10.255.255.255') || between?('192.168.0.0','192.168.255.255') | |
end | |
end | |
class Net::FTP | |
alias_method :parse227_original, :parse227 | |
alias_method :connect_original, :connect | |
def connect(host, port = FTP_PORT) |
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
for file in $(egrep --include=*.php -rl "([^a-zA-Z_]+)split\(" .) | |
do | |
# you might replace 'preg_split' with 'explode' if you don't require regex support | |
sed -E "s/([^a-zA-Z_]+)split\(/\1preg_split\(/g" $file > /tmp/tempfile.tmp | |
mv /tmp/tempfile.tmp $file | |
done |
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
:: Handbrake.bat | |
:: A batch script for losers | |
:: Set handbrake_exec to the location where your handbrake is installed | |
:: Set handbrake_preset to the desired preset (https://trac.handbrake.fr/wiki/BuiltInPresets) | |
:: Set source_dir to the folder containing the videos you wish to encode | |
:: Set output_dir to the destination where encoded videos should be saved | |
set handbrake_exec="C:\Program Files\Handbrake\HandBrakeCLI.exe" | |
set handbrake_preset="AppleTV 3" |
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/bash | |
touch $1 | |
open -a /Applications/Byword.app $1 |
NewerOlder