Skip to content

Instantly share code, notes, and snippets.

View multiplegeorges's full-sized avatar

Georges Gabereau multiplegeorges

View GitHub Profile
@multiplegeorges
multiplegeorges / coffee.bash
Created May 24, 2012 14:33 — forked from jasdeepsingh/coffee.bash
Coffee Watch for all JS in the project
# -o = Output Directory
# -c = Compile
coffee -w -o public/javascripts -c app/assets/coffeescripts
def icon(name, options = {})
# icon("camera-retro")
# <i class="icon-camera-retro"></i>
#
# icon('cogs', :class => 'large nav-item', :size => 1.5)
# <i class='icon-cogs large nav-item', style='font-size:1.5em'></i>
classes = ['icon-'+name]
classes << options[:class].split(' ') if options[:class].present?
classes = classes.flatten.join(' ')
@multiplegeorges
multiplegeorges / simpleFormat.js
Created December 20, 2012 17:32 — forked from kares/simpleFormat.js
Handlebars helper to replicate the functionality of Rails' simple_format view helper. Wraps everything in a paragraph and corrects newlines and carriage returns. Ignores all other HTML.
Handlebars.registerHelper 'simple_format', (text) ->
carriage_returns = /\r\n?/g
paragraphs = /\n\n+/g
newline = /([^\n]\n)(?=[^\n])/g
text = text.replace(carriage_returns, "\n") # \r\n and \r -> \n
text = text.replace(paragraphs, "</p>\n\n<p>") # 2+ newline -> paragraph
text = text.replace(newline, "$1<br/>") # 1 newline -> br
text = "<p>" + text + "</p>";
after "deploy:symlink", "deploy:restart_workers"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
# Get EPEL set up
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# Instal Dev Tools
yum -y groupinstall 'Development Tools'
# Install Git
yum -y install git
# Install Node