- Twitter: @scrapbookdev
- GitHub: https://github.com/simonoff
I'm software engeneer with more then 10 years experience. Last 7 years I'm using Ruby for my projects.
platforms/ | |
plugins/ |
app = node[:rails][:app] | |
rails_base app[:name] do | |
ruby_ver app[:ruby_ver] | |
gemset app[:gemset] | |
end | |
%w{config log pids cached-copy bundle system}.each do |dir| | |
directory "#{app[:app_root]}/shared/#{dir}" do | |
owner app[:deploy_user] |
I'm software engeneer with more then 10 years experience. Last 7 years I'm using Ruby for my projects.
# Adapted from a C# example here: | |
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph | |
# And thanks to John Esser for helping figure out how to | |
# calculate the targets to stabilize a negative slope! | |
class LinearRegression | |
attr_accessor :slope, :intercept | |
# Pass in an array of values to get the regression on |
# RSpec matcher to spec delegations. | |
# Forked from https://gist.github.com/ssimeonov/5942729 with fixes | |
# for arity + custom prefix. | |
# | |
# Usage: | |
# | |
# describe Post do | |
# it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
# it { should delegate(:name).to(:author).with_prefix(:any) } # post.any_name | |
# it { should delegate(:month).to(:created_at) } |
task :teamcity => ['teamcity:clean', 'teamcity:setup', 'barista:brew', 'fork:spec', 'teamcity:cucumber', 'jasmine:ci'] | |
namespace :teamcity do | |
task :setup do | |
RAILS_ENV = 'test' | |
Rake::Task['db:drop'].invoke | |
Rake::Task['db:create'].invoke | |
Rake::Task['db:schema:load'].invoke | |
end |
$ diskutil erasevolume HFS+ "postgres_ramdisk" `hdiutil attach -nomount ram://1165430`
Started erase on disk1
Unmounting disk
Erasing
Initialized /dev/rdisk1 as a 569 MB HFS Plus volume
class Hash | |
def select_and_sort_by(whitelist) | |
whitelist.inject({}) do |m,k| | |
k = k.to_sym | |
m[k] = self[k] if self.has_key?(k) | |
m | |
end | |
end | |
#!/usr/bin/env ruby | |
require 'net/smtp' | |
FILE = File.readlines("foo1") | |
class Email | |
def initialize | |
@smtp = Net::SMTP.new('127.0.0.1', 2025) | |
end | |
def post(from, to) | |
msgstr = <<EOF | |
From: <#{from}> |
<div id="selection"><a href="#"><span class="icon 44"></span>United States<span class="code"> +1</span></a></div> | |
<label id="phoneNum"> | |
Phone Number: | |
<input type="text" /> | |
</label> | |
<div id="dropdown"> | |
<div class="countryMenu"> | |
<a href="#"><span class="icon 44"></span>United States<span class="code"> +1</span></a> | |
<a href="#"><span class="icon 2311"></span>Afghanistan<span class="code"> +93</span></a> | |
<a href="#"><span class="icon 1034"></span>Albania<span class="code"> +355</span></a> |