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
alias yolo!=git add . && git commit -m "YOLO!!!" && git push --force origin master |
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 ApplicationController < ActionController::Base | |
def session | |
@session ||= SessionHijacker.new(super, request) | |
end | |
def session=(session) | |
"------ SESSION WAS REPLACED!!!" | |
super(session) | |
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
class AppBuilder < Rails::AppBuilder | |
include Thor::Actions | |
include Thor::Shell | |
def test | |
append_test_gems | |
rspec_install | |
spork_init | |
guard_init | |
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
Dir["**/*.rb"].each do |file| | |
replacements = File.open(file).read.gsub /:([a-z_]+)(\s+)?=>(\s+)?/, '\1: ' | |
file = File.open file, 'w' do |f| | |
f.write replacements | |
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
require 'benchmark' | |
def int_pal?(num) | |
n = num | |
reverse = 0 | |
while (num > 0) | |
dig = num % 10 | |
reverse = reverse * 10 + dig | |
num = num / 10 | |
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
#!/usr/bin/env ruby | |
[Method, UnboundMethod].each do |klass| | |
klass.class_eval do | |
def rubymine | |
path = source_location.join(':') | |
`mine #{path}` | |
nil |
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 BasicObject | |
def self.local_methods | |
return methods unless superclass | |
methods - superclass.methods | |
end | |
def self.local_method(sym) | |
method self.local_methods.find { |i| i == sym } | |
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
--database=postgresql | |
--skip-test-unit | |
--skip-bundle | |
--template=https://gist.github.com/jwaldrip/5538342/raw/rails-template.rb |
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
# Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files | |
# for Pry binding references | |
# | |
# Installation | |
# | |
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit | |
# | |
# Based on | |
# | |
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/ |
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 FeedItem < ActiveRecord::Base | |
# hstore is data | |
def self.field(name) | |
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 | |
def #{name}=(val) | |
self.data[:#{name}] = val | |
end |