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
file utils.rb: | |
-------------- | |
require 'webrick' | |
module Utils | |
WEBrick::HTTPStatus::StatusMessage.each do | k, v | | |
self.const_set "HTTP_#{k}_#{v.upcase.tr ' -', '_'}".to_sym, k | |
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
#! /bin/bash | |
# Create a temp file | |
program=$(mktemp /tmp/XXXX) | |
# Get the line number of the last match of __PROGRAM_START__ | |
# Just grep-ing the file to find the marker will match the grep itself | |
cut_pos=$(cat ${0} | grep -n '__PROGRAM_START__' | tail -1 | awk -F ':' '{print $1}') | |
# Get the docker image tag to run the program in |
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
TOPLEVEL_BINDING.eval( 'def task( *args, &block ); end' ) | |
load 'Rakefile' |
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 'rake' | |
rakefile = 'some-rake-file' | |
rake = Rake.application | |
rake.init | |
rake.add_import rakefile | |
rake.load_rakefile | |
rake[ :taskname ].invoke |
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
load GEMSPEC_FILE | |
ObjectSpace.each_object Gem::Specification do | instance | | |
if instance.name == GEMSPEC_FILE | |
gemspec = instance | |
break | |
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
################################################################# | |
# | |
# File: lib/api.rb | |
# | |
################################################################# | |
require 'user' # ActiveRecord model | |
# Connect to the db | |
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL']) |
NewerOlder