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
root@server:~# export CMDTEST='su cpfcnpj_mhfs_com_br -c "/usr/local/bin/unicorn -D -E production -c config/unicorn.rb"' | |
root@server:~# echo $CMDTEST | |
su cpfcnpj_mhfs_com_br -c "/usr/local/bin/unicorn -D -E production -c config/unicorn.rb" | |
root@server:~# $CMDTEST | |
su: invalid option -- 'D' | |
U |
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
" Strip trailing whitespace | |
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s |
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
Creating a gist from textmate |
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 Note; end | |
class C < Note; end | |
class Cs < C; end | |
class D < Note; end | |
class Db < D; end | |
class Ds < D; end | |
class E < Note; 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
Ctrl-L gives a hashrocket with spaces | |
Shift-Ctrl-[ alternate between {} and do/end blocks | |
Shit-Cmd-D open the require file in another window | |
Ctrl-shift-V validates syntax of ruby file | |
Ctrl-shift-E executes the line | |
Ctrl-shift-; alternate between string and symbol | |
Shift-Option-Cmd-Down show possible destinations | |
Ctrl-Shift-H create partial from selection | |
Ctrl-P gives params[:id] |
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
# coding: utf-8 | |
import struct | |
with open('in.bmp', 'rb') as fd, open('out.bmp', 'wb') as out: | |
s = fd.read(1) | |
count = 1 | |
while s: | |
if count < 37: # header bytes | |
out.write(s) |
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 'formula' | |
# some credit to http://github.com/maddox/magick-installer | |
# NOTE please be aware that the GraphicsMagick formula derives this formula | |
def ghostscript_srsly? | |
ARGV.include? '--with-ghostscript' | |
end | |
def x11? |
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
Factory.define :application do |factory| | |
factory.attachment(:sample, "public/samples/sample.doc", "application/msword") | |
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
def mod10_febraban(value) | |
result_string = "" | |
factor = 2 | |
total = 0 | |
value.each_char do |c| | |
result_string << (c.to_i * factor).to_s | |
factor = (factor == 2 ? 1 : 2) | |
end | |
result_string.each_char { |c| total += c.to_i } | |
result = 10 - total % 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
# My Method | |
def mymethod | |
# My puts | |
puts "Ruby Rocks" | |
end |