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 Cancelerizer | |
def cancel arg | |
Sidekiq::ScheduledSet.new.each do |job| | |
(klass, method, args) = YAML.load job.args.first | |
if self == klass and args.first == arg | |
job.delete | |
end | |
end | |
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
class User | |
# other stuff | |
def own_and_reviewed_jobs | |
( jobs + Job.where( reviewer: self ) ).uniq | |
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
13:31:08 1.0 ~/work/gems/rubysl-dl $ wc -l `find . -iname '*.rb'` | |
193 ./ext/rubysl/dl/extconf.rb | |
49 ./ext/rubysl/dl/install.rb | |
225 ./ext/rubysl/dl/lib/dl/import.rb | |
149 ./ext/rubysl/dl/lib/dl/struct.rb | |
245 ./ext/rubysl/dl/lib/dl/types.rb | |
25 ./ext/rubysl/dl/lib/dl/win32.rb | |
69 ./ext/rubysl/dl/mkcall.rb | |
63 ./ext/rubysl/dl/mkcallback.rb | |
25 ./ext/rubysl/dl/mkcbtable.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
#!/usr/bin/env ruby | |
File.open( 'report.txt', 'w' ) do |io| | |
io.puts <<-EOI | |
Dear Karla, | |
You're fucked, please quit. | |
Regards, | |
The Internet |
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
tags() { | |
dir=$1 | |
if [[ "$dir" == "" ]]; then | |
dir='.' | |
fi | |
if [[ ! -d $dir ]]; then | |
echo $'\e[1;31m'Error: $dir is not a directory.$'\e[0m' | |
return 1 | |
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
[4] pry(main)> x = 'foo' | |
=> "foo" | |
[5] pry(main)> <<-'X' | |
[5] pry(main)* No interpolation of #{x} | |
[5] pry(main)* X | |
=> " No interpolation of \#{x}\n" | |
[6] pry(main)> <<-"X" | |
[6] pry(main)* Interpolates #{x} | |
[6] pry(main)* X | |
=> " Interpolates foo\n" |
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
--- Portfile.orig 2013-02-06 14:04:05.000000000 -0800 | |
+++ Portfile.new 2013-02-06 14:04:10.000000000 -0800 | |
@@ -89,6 +89,7 @@ | |
--with-mhash=${prefix} \ | |
--with-pcre-regex=${prefix} \ | |
--with-readline=${prefix} \ | |
+ --with-libexpat-dir=${prefix} \ | |
--with-libxml-dir=${prefix} \ | |
--with-zlib=${prefix} \ | |
--without-pear \ |
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
def fib x | |
x <= 1 ? x : fib(x-1) + fib(x-2) | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript" src="pouchdb.js"></script> | |
<script type="text/javascript"> | |
var db; | |
$(function() { | |
db = new PouchDB('foo'); |
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
set :rails_env, ( ENV['RAILS_ENV'] = 'staging' ) | |
set :ssh_name, "stage.#{application}" | |
desc "Use with deploy to push live" | |
task :live do | |
set :rails_env, ( ENV['RAILS_ENV'] = 'production' ) | |
set :ssh_name, "live.#{application}" | |
end | |
before 'deploy:setup', :set_server |