Skip to content

Instantly share code, notes, and snippets.

View rileytg's full-sized avatar

Riley Guerin rileytg

View GitHub Profile
@rileytg
rileytg / .colors
Created January 20, 2022 16:56 — forked from daytonn/.colors
Bash Color functions
# Colors
end="\033[0m"
black="\033[0;30m"
blackb="\033[1;30m"
white="\033[0;37m"
whiteb="\033[1;37m"
red="\033[0;31m"
redb="\033[1;31m"
green="\033[0;32m"
greenb="\033[1;32m"

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

$ cd /tmp
$ rails -v 
Rails 6.0.3.2
$ 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
rileytg / add-deps.sh
Last active August 29, 2015 14:01
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...) ->
callable(dependecies)
)
@rileytg
rileytg / placeheld.coffee
Last active December 27, 2015 16:59
Placeheld.coffee 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
rileytg / Gemfile
Last active March 29, 2017 21:25
How to add a simple rich text editor to an active admin field
gem 'jquery-ui-rails'
gem 'font-awesome-rails'
#!/bin/bash
# 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
rileytg / redmine.rb
Last active December 18, 2015 16:09
example api call into ruby obj
require 'json'
require 'rest-client'
response = RestClient.get "/gem/#{name}.json"
version = JSON.parse(response)['version']
def download_file(url)
uri = URI(url)
Rails.logger.info("Downloading evidence #{id} from filepicker.io")
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
request = Net::HTTP::Get.new(uri.path)
http.request(request) do |response|
file = File.new('evidence')
-#<!-- 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:",z=c.name,r="load";var nt=function(){
f[z]=function(){
(a.s=a.s||[]).push(arguments)};var a=f[z]._={
},q=c.methods.length;while(q--){(function(n){f[z][n]=function(){
f[z]("call",n,arguments)}})(c.methods[q])}a.l=c.loader;a.i=nt;a.p={
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){