Skip to content

Instantly share code, notes, and snippets.

@biscuitvile
biscuitvile / .vimrc.local
Created December 23, 2011 16:06
Jack Kinsella's .vimrc
" Make Nerd Tree smaller
let NERDTreeWinSize=16
autocmd VimEnter * wincmd l
" have long lines wrap by defaults
set wrap
" change line numberings for ease with writing commands
set relativenumber
@biscuitvile
biscuitvile / extra_sauce.rb
Created March 2, 2012 17:27
More Descriptive RSPec output for Acceptance tests
require 'rspec/core/formatters/base_text_formatter'
module ExtraDoc
def example_passed(example)
example.description << " #{example.metadata[:extra_doc]}"
end
end
RSpec::Core::Formatters::BaseTextFormatter.send(:include, ExtraDoc)
@biscuitvile
biscuitvile / rename.rake
Created March 9, 2012 12:53 — forked from ebot/rename.rake
A Rails 3 rake task for renaming the application
namespace 'rails' do
desc 'Renames the current app'
task 'rename' do
# Get the new name
new_name = ENV["NEW_NAME"].capitalize || nil
if new_name.nil?
puts "\nYou must pass in a new name"
exit
end
@biscuitvile
biscuitvile / will_paginate.rb
Created March 12, 2012 18:37 — forked from isaacbowen/will_paginate.rb
extends will_paginate to play well with Twitter's Bootstrap
# config/initializers/will_paginate.rb
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@biscuitvile
biscuitvile / highchart-updating.js
Created March 13, 2012 16:03
Highchart updating
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
xAxis: {
categories: ['Category 1', 'Category 2']
},
plotOptions: {
series: {
cursor: 'pointer',
@biscuitvile
biscuitvile / simple_form.rb
Created April 6, 2012 23:36 — forked from seyhunak/simple_form.rb
Using simple_form and integrating Twitter Bootstrap
1. Use latest build
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
2. Create an initializer
# /config/initializers/simple_form.rb
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a complete input.
# You can remove any component from the wrapper, change the order or even
class PostPresenter < BasePresenter
presents :post
def published
created_at.to_s(:date_long)
end
def author
post.author_name
end
@biscuitvile
biscuitvile / rails-backbone-test-setup.md
Created May 1, 2012 15:44 — forked from smakman/rails-backbone-test-setup.md
Setting up a Rails backbone project with Jasmine, RSpec, Capybara, Guard and Spork

Rails backbone test setup

This gist describes how to setup a rails backbone project with testing frameworks.

Gemfile

Example Gemfile to start with.

@biscuitvile
biscuitvile / character_reference.rb
Created May 2, 2012 15:52 — forked from norman/character_reference.rb
HTML entities? We don't need no stinkin' HTML entities.
# coding: utf-8
#
# Encode any codepoint outside the ASCII printable range to an HTML character
# reference (http://bit.ly/KNupLT).
def encode(string)
string.each_codepoint.inject("") do |buffer, cp|
cp = "&#x#{cp.to_s(16)};" unless cp >= 0x20 && cp <= 0x7E
buffer << cp
end
end
@biscuitvile
biscuitvile / gist:2698899
Created May 15, 2012 03:39 — forked from palexander/gist:1375271
Remove a password from Git's history
# Sync with the remote master
git pull
# Force your clone to look like HEAD
git reset --hard
# AGAIN, A WARNING: This can really break stuff!
# Run your filter branch command, replacing all instances of "password" with "your_password"
# The example looks for Ruby files ("*.rb"), you can change this to match your needs