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
#!/bin/sh | |
VBM=VBoxManage | |
VMNAME="smartos2" | |
VBDIR="/Users/me/Documents/VirtualBox" | |
DISK=1024 # 1GB | |
RAM=1024 # 1GB | |
VRAM=128 # arbitrary | |
mkdir -p "${VBDIR}/${VMNAME}" && cd "${VBDIR}/${VMNAME}" | |
[[ -f ${VMNAME}.iso ]] || curl -C - -o "${VMNAME}.iso" https://download.joyent.com/pub/iso/latest.iso | |
$VBM createvm --name $VMNAME --ostype OpenSolaris_64 --register |
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
<% [:notice, :error, :alert, :success].each do |level| %> | |
<% unless flash[level].blank? %> | |
<div class="alert alert-<%= flash_class(level) %>"> | |
<a class="close" href="#">×</a> | |
<%= content_tag :p, flash[level] %> | |
</div> | |
<% 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
∴ RAILS_ENV=test rake db:migrate | |
rake aborted! | |
uninitialized constant RSpec::Core::Hooks | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:29:in `<cl | |
ass:Configuration>' | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:28:in `<mo | |
dule:Core>' | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:4:in `<mod | |
ule:RSpec>' | |
/Users/derek/.rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:3:in `<top |
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
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb |
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
module MyApp | |
class Money | |
include Mongoid::Fields::Serializable | |
def cast_on_read?; true; end | |
def deserialize(object) | |
return nil if object.blank? | |
::Money.new(object[:cents] || object["cents"], object[:currency] || object["currency"]) | |
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
require 'mongoid' | |
class Foo | |
include Mongoid::Document | |
field :bar, :type => String | |
validates_uniquness_of :bar | |
end | |
foo = Foo.new |
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
dig +short {,www.}example.{com,net,org} |
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
module Mokha | |
class HomeController < Mokha::BaseController | |
def index | |
@view = Mokha::HomePresenter.new | |
@view.user = User.includes(:ratings).find(current_user) | |
@view.user.track('Opened Mokha') | |
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
" Strip trailing whitespace | |
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s |
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
module Extensions | |
module_function | |
def separate(path) | |
extensions = path.reverse | |
.scan(/\G\w+\./) | |
.map { |e| e[0..-2].reverse } | |
.reverse | |
file_name = path.split(".")[0..-(extensions.size + 1)].join(".") | |
[file_name, extensions] |