Skip to content

Instantly share code, notes, and snippets.


Riley Guerin rileytg

View GitHub Profile
View why so much js?.md

Why do I need 106mb of JS for an empty rails app?

$ cd /tmp
$ rails -v 
$ rails new my-app 
Using -T -d postgresql from /Users/rileytg/.railsrc # use postgres, dont use tests (usually add rspec). this is a fairly common rails stack.
Bundle complete! 14 Gemfile dependencies, 65 gems now installed.
rileytg /
Last active Aug 29, 2015
require js config for a yeoman project
# grunt buildcontrol
npm install --save-dev grunt-build-control
# Require JS
npm install --save-dev grunt-processhtml grunt-contrib-requirejs
bower install --save requirejs
# Jasmine Testing
npm install --save-dev grunt-template-jasmine-requirejs grunt-contrib-jasmine
runWithDepedencies = (dependencyArray, callable) ->
define(depedencyArray, (dependencies...) ->
rileytg /
Last active Dec 27, 2015 for js placeholders
class window.Placeheld
constructor: (element) ->
@input = $(element)
placeholder = @input.attr('placeholder')
if placeholder && @input.attr('data-placeheld') != 'on'
@input.attr('placeholder', '')
@input.attr('data-placeheld', 'on')
@input.siblings().add(@input).wrap('<div class="placeholding-input"/>')
@input.after("<span class=\"placeholder\"> #{placeholder} </span>")
@input.siblings('.placeholder').click(() =>
rileytg / Gemfile
Last active Mar 29, 2017
How to add a simple rich text editor to an active admin field
View Gemfile
gem 'jquery-ui-rails'
gem 'font-awesome-rails'
# Make sure we're all updated
sudo apt-get update
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get install nodejs
rileytg / redmine.rb
Last active Dec 18, 2015
example api call into ruby obj
View redmine.rb
require 'json'
require 'rest-client'
response = RestClient.get "/gem/#{name}.json"
version = JSON.parse(response)['version']
View download.rb
def download_file(url)
uri = URI(url)"Downloading evidence #{id} from")
Net::HTTP.start(, uri.port, :use_ssl => uri.scheme == 'https') do |http|
request =
http.request(request) do |response|
file ='evidence')
View olark.html.haml
-#<!-- begin olark code -->
%script(data-cfasync="false" type='text/javascript')
/*<![CDATA[*/window.olark||(function(c){var f=window,d=document,l=f.location.protocol=="https:"?"https:":"http:",,r="load";var nt=function(){
(a.s=a.s||[]).push(arguments)};var a=f[z]._={
0:+new Date};a.P=function(u){
a.p[u]=new Date-a.p[0]};function s(){
a.P(r);f[z](r)}f.addEventListener?f.addEventListener(r,s,false):f.attachEvent("on"+r,s);var ld=function(){function p(hd){
rileytg /
Created Oct 14, 2012 — forked from johnbeynon/
Heroku Hubot Script
# A limited way to interact with the Heroku API.
# 1. Create file in scripts folder in hubot folder
# 2. Update package.json for hubot and add dependency on "sprintf": "0.1.1"
# 3. Set heroku config variable HEROKU_USER to heroku user account to use
# 4. Set heroku config variable HEROKU_APIKEY to heroku user account apikey (from My Account page)
# heroku status - Retrieve the most recent tweet from the @herokustatus account
# heroku ps --app <appname> - Get process information for application