Skip to content

Instantly share code, notes, and snippets.

graceavery / harryPotterAliases
Last active May 20, 2020
bash aliases for Harry Potter enthusiasts
View harryPotterAliases
alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv
alias sonorus='set -v'
alias quietus='set +v'
prantlf / jasmine.toBeInstanceOf.js
Last active Sep 2, 2018
A Jasmine matcher checking if the actual object is an instance of the expected type
View jasmine.toBeInstanceOf.js
// Checks if the actual object is an instance of the expected type;
// the functional object `expected` can be any ancestor prototype.
// Example:
// expects(new Backbone.Model()).toBeInstanceOf(Backbone.Model);
jasmine.Matchers.prototype.toBeInstanceOf = function(expected) {
var actual = this.actual,
notText = this.isNot ? ' not' : '';
this.message = function() {
return 'Expected ' + actual + notText + ' to be an instance of ' + expected;
iclems / Firebase Lazy-Safe Iterator
Last active Jun 21, 2018
This snippet enables to iterate over a Firebase reference in a non-blocking way. If you need to iterate over a large reference, a child_added query may block your Firebase as it will query the whole data before iteration. With this snippet, children are retrieved one by one, making it slower / safer.
View Firebase Lazy-Safe Iterator
// By Clément Wehrung
function Iterator(queueRef, processingCallback) {
this.queueRef = queueRef;
this.processingCallback = processingCallback;
this.processed = {};
Iterator.prototype.processNext = function() {
katowulf / gist:4741111
Last active Oct 28, 2020
Firebase security rules for a simple chat room model
View gist:4741111
"chat": {
// the list of chats may not be listed (no .read permissions here)
// a chat conversation
"$key": {
// if the chat hasn't been created yet, we allow read so there is a way
// to check this and create it; if it already exists, then authenticated
// user (specified by must be in $key/users
adamyanalunas / jasmine.toBeTypeOf.js
Created Oct 21, 2012
jasmine.js matcher to test type of object
View jasmine.toBeTypeOf.js
jasmine.Matchers.prototype.toBeTypeOf = function(expected) {
var actual, notText, objType;
actual = this.actual;
notText = this.isNot ? 'not ' : '';
objType = actual ? : '';
this.message = function() {
return 'Expected ' + actual + notText + ' to be an array';
zacwasielewski / gist:2794562
Created May 26, 2012
Gutter-free columns for Twitter Bootstrap
View gist:2794562
Occasionally you need to eliminate the gutters from your grid columns. Include
this SCSS in your project and add a class of .row-nogutter to any <div class="row">
to magically remove its gutters. Not incredibly well-tested, but works for me.
This currently only works for standard (non-fluid) grids.
maxbrunsfeld / backbone_super.js
Created Dec 30, 2011
A 'super' method for backbone.js (plain javascript)
View backbone_super.js
// This method gives you an easier way of calling super
// when you're using Backbone in plain javascript.
// It lets you avoid writing the constructor's name multiple
// times. You still have to specify the name of the method.
// So instead of having to write:
// User = Backbone.Model.extend({
// save: function(attrs) {
// this.beforeSave(attrs);
michiel / cors-nginx.conf
Created Jul 5, 2011
Wide-open CORS config for nginx
View cors-nginx.conf
# Wide-open CORS config for nginx
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
You can’t perform that action at this time.