Skip to content

Instantly share code, notes, and snippets.

@millisami
millisami / Vagrantfile
Last active Dec 22, 2015
Vagrantfile server
View Vagrantfile
sudo apt-get update
sudo apt-get -y install curl
curl -L get.rvm.io | bash -s stable --auto
source ~/.bash_profile
rvm requirements
sudo apt-get install -y build-essential openssl libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev libxml2-dev libxslt-dev python-software-properties
rvm install ruby
View layout_helper.rb
# These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
content_for(:title) { h(page_title.to_s) }
@show_title = show_title
end
View test stdout
zeus test spec/acceptance/learning_areas_spec.rb:22
No DRb server is running. Running in local process instead ...
Run options: include {:locations=>{"./spec/acceptance/learning_areas_spec.rb"=>[22]}}
Learning area pages
Slow factory: "child" using strategy "create"
Slow factory: "child" using strategy "create"
cache: [GET /videos/1] miss
cache: [GET /assets/head.js] miss, store
cache: [GET /assets/application.css] miss, store
@millisami
millisami / gist:6061824
Created Jul 23, 2013
cache logger ugly
View gist:6061824
#FILE: config/environments/test.rb
class DisableAssetsLogger
def initialize(app)
@app = app
Rails.application.assets.logger = Logger.new('/dev/null')
end
def call(env)
previous_level = Rails.logger.level
View qs_to_hash.rb
# Today's little useless tidbit converts a url's query string into a hash
# set of k/v pairs in a way that merges duplicates and massages empty
# querystring values
def qs_to_hash(query_string)
keyvals = query_string.split('&').inject({}) do |result, q|
k,v = q.split('=')
if !v.nil?
result.merge({k => v})
elsif !result.key?(k)
@millisami
millisami / octopress bug
Created Jul 7, 2013
octopress does not start the server
View octopress bug
$ git clone git://github.com/imathis/octopress.git octopress-new
$ cd octopress-new
$ bundle
$ bundle exec rake watch
Starting to watch source with Jekyll and Compass.
directory source/stylesheets/
create source/stylesheets/screen.css
Configuration from /Users/millisami/Code/octopress-new/_config.yml
>>> Change detected at 18:47:05 to: screen.scss
Auto-regenerating enabled: source -> public
View Gor Listener
## Listener verbose log
ubuntu@ip-10-86-229-133:~$ sudo ./gor-linux-amd64 listen -p=80 -r="localhost:28020" -verbose=true
Version: 0.3
Listening for HTTP traffic on 80 port
Forwarding requests to replay server: localhost:28020
2013/06/25 12:28:47 Error while parsing request: b32a7da; __utmb=109050450.2.10.1372162652; __utmc=109050450; kvcd=1372163182598; km_vs=1; mp_03d1c47374408c67e078699b1ffbdf75_mixpanel=%7B%22distinct_id%22%3A%20%2213d8748965e2b-0cd07e5db6d96d-436e2b42-13c680-13d874896604b5%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D
Connection: keep-alive
View gist:5657872
* php_pear[mail] action install[2013-05-27T15:50:45+00:00] INFO: Processing php_pear[mail] action install (mediawiki::setup line 22)
Retrieving data...0%
....50%...MATCHED PACKAGES, CHANNEL PEAR.PHP.NET:
=======================================
PACKAGE STABLE/(LATEST) LOCAL
Mail 1.2.0 (stable) Class that provides multiple interfaces for sending emails
Mail_IMAP 1.1.0RC2 (beta) Provides a c-client backend for webmail.
Mail_IMAPv2 0.2.1 (beta) Provides a c-client backend for webmail.
Mail_Mbox 0.6.3 (beta) Read and modify Unix MBOXes
Mail_Mime 1.8.7 (stable) Mail_Mime provides classes to create MIME messages.
View gist:5650122
○ VAGRANT_LOG=debug vagrant up --provider=aws 1.9.3-p194@global
INFO global: Vagrant version: 1.2.2
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commands/box/plugin.rb
INFO manager: Registered plugin: box command
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commands/destroy/plugin.rb
INFO manager: Registered plugin: destroy command
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commands/halt/plugin.rb
INFO manager: Registered plugin: halt command
DEBUG global: Loading core plugin: /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commands/init/plugin.rb
INFO manager: Registered plugin: init command
View rumble.sh
#!/bin/sh
# ====================================================================
# This is the tmux configuration I use for setting up my Ruby on Rails
# Tutorial session
#
BASE="$HOME/sites/sample_app"
cd $BASE
tmux start-server