Skip to content

Instantly share code, notes, and snippets.

<% git_results = `git rev-parse --abbrev-ref HEAD` %>
<style type="text/css" media="screen">
div.git-box {
border:5px solid #f00;
background-color: #fff;
width: 600px;
margin: 0 auto;
font-color: #f00;
font-size: 20px;
-# Generate popup windows
#locations{:style => 'display: none'}
- for location in @locations
%div[location]
%div{:style => 'width: 350px'}
- if location.photo?
%img{:src => location.photo.url(:thumb), :style => "float: left; padding: 5px;"}
= link_to(location.product.name, { :controller => 'products', :action => 'show', :id => location.product })
%br/
%strong= location.name
1.8.7 :001 > require 'rubygems'
=> true
1.8.7 :002 > require 'rbing'
=> true
1.8.7 :003 > RBing.new ''
=> #<RBing:0xb74c667c @instance_options={:AppId=>""}>
1.8.7 :004 > exit
atrosity@Atro-Mint ~ $ gem -v
1.8.21
class User
include Mongoid::Document
extend Rolify
rolify
end
(KICK)\s(#\w*)
@ericraio
ericraio / bundler.rb
Created September 3, 2012 02:36
Neat Things With Bundler
source “http://rubygems.org”
gem “rails”
gem “rack-cache”, :require => “rack/cache” gem “nokogiri”, “~> 1.4.2″
group :development do3
gem “sqlite3″
end
group :staging do3
// Secure random hex in js like SecureRandom.hex in ruby
function secureRandom(n){
n = n+1 || 17;
var str = [];
while (--n) {
var r = Math.floor(Math.random()*256)
.toString(16)
.substr(Math.floor(Math.random()*2),1)
|| String.fromCharCode(65+(Math.floor(Math.random()*8)));
function calculateIraq (multiplier) {
var previouslyAllocated = 797310713001; // amount previously allocated for all prior years combined
var ratePerMS = 0.318675948653 ; // the rate per MS of the war for current fiscal year
var curDate = new Date(); // today's date
var diff = curDate - startFiscalYear; // MS between today and start of fiscal year
costOfIraq = (previouslyAllocated + (diff * ratePerMS)) * multiplier; // cost of Iraq war at this time
}
function calculateAg (multiplier) {
var previouslyAllocated = 459786487495; // amount previously allocated for all prior years combined
class PostsController < ApplicationController
include ActionController::Live
before_filter :authenticate_user!, only: [:new, :create, :edit, :update, :destroy]
before_filter :set_post, only: [:show, :edit, :update, :destroy]
# GET /posts/:slug
def show
end
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD