Skip to content

Instantly share code, notes, and snippets.

View wrburgess's full-sized avatar
:shipit:
Shippin'

Randy Burgess wrburgess

:shipit:
Shippin'
View GitHub Profile
@saintplay
saintplay / counter.function.js
Last active October 17, 2021 17:00
Add counter for Firestore Collection
// functions/income/counter.function.js
'use strict'
const functions = require('firebase-functions')
const admin = require('firebase-admin')
// Prevent firebase from initializing twice
try { admin.initializeApp(functions.config().firebase) } catch (e) {}
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@itskingori
itskingori / application_controller.rb
Last active March 4, 2024 09:07 — forked from speed-of-light/application_controller.rb
How to handle exceptions like 401, 501, 404 in Rails
# As used with CanCan and Devise
class ApplicationController < ActionController::Base
protect_from_forgery
include ErrorResponseActions
rescue_from CanCan::AccessDenied, :with => :authorization_error
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
before_filter :authenticate!
@thegrubbsian
thegrubbsian / backbone_base.js
Last active December 10, 2015 15:18
Backbone Extensions Stuff
Backbone.Base = function() {
this.initialize.apply(this, arguments);
};
Backbone.Base.extend = Backbone.Model.extend;
_.extend(Backbone.Base.prototype, Backbone.Events, {
initialize: function() {}
});
@daytonn
daytonn / aliases.sh
Created July 29, 2012 21:47
My bash aliases
#File System
alias files="ls -l | grep -v ^d"
alias folders="s -ld */"
alias hidden="ls -ld .??*"
alias trash="rm -rf ~/.Trash/*"
alias delete="rm -Rf"
alias remove="rm -Rf"
alias lcl="cd /usr/local"
alias src='cd /usr/local/src'
alias bin='cd /usr/local/bin'
@inopinatus
inopinatus / hstore_accessor.rb
Last active February 22, 2019 08:32
hstore accessor class method for AR
# include from an initializer
module HstoreAccessor
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def hstore_accessor(hstore_attribute, *keys)
Array(keys).flatten.each do |key|
@siffring
siffring / function_as_parameter.js
Created October 7, 2011 18:14
Javascript: pass a function as a parameter to another function
// pass a function as a parameter of another function
function doAnotherThing() {
console.log('Doing another thing…');
}
function doSomething(callback) {
console.log('Doing something…');
if (typeof callback == 'function') {
callback.call();
@jondkinney
jondkinney / setup_textmate_rails_dev.md
Created June 16, 2011 08:16
Setup Textmate for Rails Dev on OS X

##Setup Textmate for Rails Dev on OS X

This guide was written by Jon Kinney for the Green Bay Ruby User Group. Jon works at Intridea and they graciously sponsor the Green Bay RUG meetings.

These guides were also partially completed using time from Intridea's SparkTime initiative which aims to give employees "outside projects" to work on during their normal work week.

If you find any issues with these suggestions please let me know. I've amassed these tips/tricks over several years of full time Rails development using Textmate but just because it works on my system doesn't always mean it will be problem free universally. Thanks to all the blog authors whose articles helped me learn Textmate over the years but whose links/posts I've lost or forgotten over time. If you have a cool Textmate tip or trick please post it in the comments!

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')