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 Leaky | |
def wow | |
locations = [1,2,3] | |
locs = Hash.new(0) | |
locations.each do |x| | |
number = 10 | |
p number | |
end | |
p number | |
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
class User < ActiveRecord::Base | |
attr_accessible :email, :first_name, :last_name, :username | |
before_validation :lol, :on => :create | |
before_validation :yay, :on => :create | |
before_validation :yay, :on => :update | |
def lol | |
puts "Running lol" | |
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
#!/usr/bin/env bash | |
apt-add-repository -y ppa:brightbox/ruby-ng | |
apt-get -y update | |
apt-get -y install build-essential | |
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev | |
apt-get -y install ruby1.9.3 ruby-switch | |
ruby-switch --set ruby1.9.1 | |
gem install chef ruby-shadow --no-ri --no-rdoc |
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
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You under the Apache License, Version 2.0 | |
(the "License"); you may not use this file except in compliance with | |
the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
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
#WARNING do not load this file in environments other than test | |
module AfterCommitPatch | |
def transaction(options = {}) | |
rolled_back = false | |
return_value = nil | |
begin | |
return_value = super | |
rescue ActiveRecord::Rollback => e | |
puts e.message | |
puts e.backtrace |
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
loop do | |
begin | |
puts "Whoa" | |
sleep(2) | |
rescue Exception => e | |
puts "wtf" | |
end | |
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
cloudips-create.rb | |
6: c.flag [:i, "count"] | |
9: c.flag [:n, :name] | |
12: c.flag [:t, :'port-translators'] | |
cloudips-update.rb | |
6: c.flag [:r, "reverse-dns"] | |
12: c.flag [:n, :name] | |
15: c.flag [:t, :'port-translators'] |
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 'cl) ; If you don't have it already | |
(defun* get-closest-gemfile-root (&optional (file "Gemfile")) | |
"Determine the pathname of the first instance of FILE starting from the current directory towards root. | |
This may not do the correct thing in presence of links. If it does not find FILE, then it shall return the name | |
of FILE in the current directory, suitable for creation" | |
(let ((root (expand-file-name "/"))) ; the win32 builds should translate this correctly | |
(loop | |
for d = default-directory then (expand-file-name ".." d) | |
if (file-exists-p (expand-file-name file d)) |
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
#!/usr/bin/env ruby | |
require "fileutils" | |
require "set" | |
class GetShitDone | |
attr_accessor :hosts_file | |
def initialize | |
@hosts_file = "/etc/hosts" | |
@banned_sites_file = "#{ENV['HOME']}/.banned_sites" |
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 "readline" | |
require "pry" | |
require "fileutils" | |
class CompileObjectiveC | |
attr_accessor :code_lines | |
TMP_DIR = "/tmp" | |
def initialize |