As configured in my dotfiles.
start new:
tmux
start new with session name:
| Gemfile.lock merge=bundlelock | |
| db/schema.rb merge=railsschema |
| # this does not run as a complete script :( | |
| pkg_add -r bash curl sudo | |
| pkg_add -r git vim # can you live without it? | |
| pkg_add -r libxml2 libxslt # for nokogiri later | |
| pw usermod pzol -G wheel | |
| bash # start bash and run the rest inside it | |
| curl -# -L http://bit.ly/rvm-install-system-wide > rvm-install-system-wide | |
| bash -l < rvm-install-system-wide |
| if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
| begin | |
| rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
| rvm_lib_path = File.join(rvm_path, 'lib') | |
| $LOAD_PATH.unshift rvm_lib_path | |
| require 'rvm' | |
| RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
| rescue LoadError | |
| raise "RVM ruby lib is currently unavailable." | |
| end |
| # create the template | |
| template = PageOfflineTemplate.new | |
| template.quote = quote | |
| template.pages = quote.build_pages | |
| # Here I render a template with layout to a string then a PDF | |
| pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml") | |
| class Address < ActiveRecord::Base | |
| has_many :phonings, :as => :phonable | |
| has_many :phone_numbers, :through => :phonings | |
| accepts_nested_attributes_for :phonings, :allow_destroy => true | |
| end |
| # encoding: utf-8 | |
| class AvatarUploader < CarrierWave::Uploader::Base | |
| include CarrierWave::MiniMagick | |
| # Choose what kind of storage to use for this uploader: | |
| storage :file | |
| # Override the directory where uploaded files will be stored. |
| module InterruptibleSleep | |
| def interruptible_sleep(seconds) | |
| @_sleep_check, @_sleep_interrupt = IO.pipe | |
| IO.select([@_sleep_check], nil, nil, seconds) | |
| end | |
| def interrupt_sleep | |
| @_sleep_interrupt.close if @_sleep_interrupt | |
| end | |
| end |
| #!/usr/bin/env ruby | |
| # A simply utility to show character counts for each line of input and | |
| # highlight lines longer than 80 characters. | |
| # | |
| # Written as an example for http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html | |
| # | |
| # Examples: | |
| # | |
| # $ hilong Gemfile |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| #!/bin/sh | |
| # Credentials for a MySQL user with PROCESS, SUPER permissions | |
| USERNAME= | |
| PASSWORD= | |
| # MySQL Server location | |
| HOST=127.0.0.1 | |
| PORT=3306 |