Skip to content

Instantly share code, notes, and snippets.

View bfricka's full-sized avatar

Brian Frichette bfricka

  • Eturi Corp
  • San Diego
View GitHub Profile
@bfricka
bfricka / package.json
Created March 28, 2013 06:42
Package.json Boilerplate
{
"name": "",
"description": "",
"version": "0.0.0",
"private": true,
"author": "Brian Frichette",
"homepage": "",
"contributors": [ "Brian Frichette <brian.frichette@gmail.com> (https://github.com/brian-frichette)" ],
"bugs": { "url": "" },
"scripts": { "start": "nodemon app.js" },
@bfricka
bfricka / bind-polyfill.coffee
Created April 6, 2013 03:15
Bind Polyfill in Coffeescript
unless Function::bind
Function::bind = (oThis) ->
# closest thing possible to the ECMAScript 5 internal IsCallable function
if typeof this isnt "function"
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")
aArgs = Array::slice.call(arguments, 1)
fToBind = this
fNOP = ->
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
###
Initialize a new `Emitter`.
@api public
###
module.exports = Emitter = (obj) ->
return mixin(obj) if obj
@_callbacks = {}
###
@bfricka
bfricka / storageClass.coffee
Last active December 10, 2015 17:08
Amplify.Store Storage Wrapper
# This is really just an interaction wrapper for amplify
# I prefer this syntax for interacting with storage.
class Stor
# Constructor sets defaults for amplify
# and optionally for expiration and key
constructor: (key, exp) ->
@key = if key? then key else undefined
@exp = if exp? then exp else null
@amp = amplify.store
@bfricka
bfricka / angular-slide-fade.coffee
Created January 1, 2013 07:01
AngularJS slideFade / fade directives
# Requires jQuery.slideFade.coffee gist
# https://gist.github.com/4425644
app.directive 'slideFadeShow', ->
(scope, elem, attrs) ->
$elem = $(elem)
exp = attrs.slideFadeShow
duration = 600
slideElem = (toShow, init = false) ->
@bfricka
bfricka / jQuery.easing.coffee
Last active December 10, 2015 11:09
jQuery.easing Coffee
# jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
# Uses the built in easing capabilities added In jQuery 1.1 to offer multiple easing options
# TERMS OF USE - jQuery Easing
###
jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
Copyright (c) 2008 George McGinley Smith and (c) 2001 Robert Penner
Open source under the BSD License. (http://www.opensource.org/licenses/bsd-license.php)
@bfricka
bfricka / ua.coffee
Created January 1, 2013 06:56
Simple User Agent
###
Adapted from jqMobi (appMobi)
https://github.com/appMobi/jQ.Mobi
MIT License
###
window.UserAgent = ->
self = @
self.ua = navigator.userAgent
self.os = {}
@bfricka
bfricka / jQuery.slideFade.coffee
Created January 1, 2013 06:44
jQuery.slideFade
# By default requires jQuery.easing by default
# change default easing to 'swing' if not using
# jQuery.slideFade
# Copyright © Brian Frichette, 2012+, All Rights Reserved.
# License: MIT http://opensource.org/licenses/mit-license.php
# Usage:
# @param {String} type A string value of either 'show', 'hide', or 'toggle' (default: 'toggle')
@bfricka
bfricka / cookies.coffee
Created January 1, 2013 06:47
CoffeeScript Cookie Class
class Cookie
constructor: (opts) ->
c = @
def =
path: '/'
domain: ''
expires: do ->
d = new Date().setFullYear(2020)
d = new Date(d).toGMTString()
d