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
export MRUBY_HOME=/opt/rubies/mruby-20150906 | |
crystal run --link-flags -L${MRUBY_HOME}/lib/ hello.cr |
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
>> Disease.find(2) | |
=> #<Disease id: 2, name: "MS", symptom_survey_lifespan: 30, disease_status_id: 3, key: "ms", community_manager_id: 3187, created_at: nil, updated_at: nil> | |
>> User.first | |
# => #<User id: 22, verified: true, deleted: false, created_at: "2008-07-03 13:36:57", updated_at: "2010-09-23 03:18:13", first_name: "Justin", last_name: "Smith", title: "wife", disease_id: 2, address: nil, city: "Boston", state: "MA", country: "United States", sex: nil, birth_date: nil, deceased_date: nil, permit_registry: nil, height: nil, display_height_unit: nil, display_weight_unit: nil, allows_public_view: false, lat: #<BigDecimal:1098c57d0,'0.28228671E2',18(18)>, lng: #<BigDecimal:1098c56e0,'-0.81653075E2',18(18)>, postcode: "02142", last_activity_time: "2008-07-03 13:38:10", last_update_time: nil, allows_badge: false, timezone: nil, phone: nil, messaging_privileges: nil, role_id: 5, unsubscribe_token: "21a497dae68b11780871083eddd6a3f201389bd6", welcome_message_sent_on: "2009-03-24", system_welcome_message_sent_o |
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
gem 'rdebug', '0.1', :group => :development, :require => false |
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
From bef595dbdbde5725b8d49242b10a400db38134d1 Mon Sep 17 00:00:00 2001 | |
From: Ben Zack <bzack@patientslikeme.com> | |
Date: Mon, 11 Jul 2011 15:42:24 -0400 | |
Subject: [PATCH] Added levenshtein distance for determining database name | |
from branch name | |
--- | |
Gemfile | 1 + | |
Gemfile.lock | 2 ++ | |
lib/devdb.rb | 18 ++++++++++++++++++ |
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
# thanks from: http://aaroncrane.co.uk/2009/03/git_branch_prompt/ | |
function find_git_branch { | |
local dir=. head | |
git_dir=${PWD} | |
until [ "$dir" -ef / ]; do | |
if [ -f "$dir/.git/HEAD" ]; then | |
head=$(< "$dir/.git/HEAD") | |
if [[ $head == ref:\ refs/heads/* ]]; then | |
git_branch="${head#*/*/}" | |
elif [[ $head != '' ]]; then |
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 "objspace" | |
ObjectSpace.trace_object_allocations_start | |
def log_object_space | |
ObjectSpace.trace_object_allocations_stop | |
object_hash = {} | |
ObjectSpace.each_object do |o| | |
key = "#{ObjectSpace.allocation_sourcefile(o)}" #:#{ObjectSpace.allocation_sourceline(o)}" | |
object_hash[key] ||= Hash.new { |h, _| h[:count] = 0; h[:memsize] = 0 } |
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
brew install nginx |
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
#aptitude (/ search, + install, gg - go) | |
contents | |
apt-file list $* | |
install | |
apt-get install | |
upgrade | |
apt-get upgrade | |
remove | |
apt-get --purge remove $* | |
list installed |
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
# Create a file: config/torquebox_remote.rb | |
TorqueBox::RemoteDeploy.configure do | |
torquebox_home "/usr/local/torquebox" | |
jruby_home "/usr/local/jruby" | |
hostname "10.0.3.50" | |
#port "22" | |
user "deployer" | |
key "#{ENV['HOME']}/.ssh/deployer_rsa" | |
#sudo true | |
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" | |
require 'erb' | |
d=Time.now | |
Benchmark.bm(20) do |x| | |
# the ultimate, but still can't figure out how to generate something that can be interpolated | |
x.report("n - str") { 100_000.times { | |
"abc #{d.hour < 10 ? '0' : ''}#{d.hour} #{d.min < 10 ? '0' : ''}#{d.min} cdef" | |
} } |