Skip to content

Instantly share code, notes, and snippets.

View SimplGy's full-sized avatar

Eric Miller SimplGy

View GitHub Profile
@toolness
toolness / baconjs-infinite-scroll.html
Last active August 29, 2015 14:05
An attempt to implement infinite scrolling using Bacon.js, a Functional Reactive Programming (FRP) library.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Bacon.js Infinite Scroll Attempt #2</title>
<p>Keep scrolling down to see more numbers.</p>
<div id="results"></div>
<img id="throbber" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Ajax-loader.gif" style="position: fixed; bottom: 4px; right: 4px;">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.22/Bacon.js"></script>
<script>
var pageChanged = new Bacon.Bus();
@gilesbowkett
gilesbowkett / spec_helper.coffee
Created September 29, 2011 20:50
expect(foo).toBeInstanceOf(Bar)
# https://github.com/pivotal/jasmine/pull/70/files
jasmine.Matchers.prototype.toBeInstanceOf = (klass) ->
this.actual instanceof klass
@cimmanon
cimmanon / animationPlay
Last active December 18, 2015 08:09 — forked from SimplGy/animationPlay
@function foo-shadow($color, $size, $layers: 1) {
$transparency: (10 - $layers) * .1;
$opts: ();
@for $i from 1 to $layers {
$opts: append($opts, 0 0 0 ($size * $i) transparentize($color, $transparency + (.1 * $i)), comma);
}
@return $opts;
}
$colorGood: lawngreen;
@thebyrd
thebyrd / magicMethod.js
Last active December 19, 2015 05:49
Adds jQuery style getters and setters to a given constructor function.
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
}
var getParamNames = function (func) {
var funStr = func.toString()
return funStr.slice(funStr.indexOf('(')+1, funStr.indexOf(')')).match(/([^\s,]+)/g)
}
// Make it Nasty
function increment (i) {
i ^= (i & ~-~i) | (~i & -~i)
return i
}

Rough outline of asset deployment strategy

Goals

  • Separate front end "client" deployment and build process from backend deployment.
  • Not necessarily have to create two completely distinct applications (because of authentication difficulties etc), but could go in that direction if needed.
  • Migratable to from the asset pipeline & compatible with rails.
  • Support coffeescript, sass compilation.
  • Allow lightweight "staging" clients to be deployed using the existing backend. Ideally even use the production backend with a development client.
  • Fast compilation and deployment.
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface ErrorFormatter : NSObject
@property (strong, nonatomic) NSError *error;
- (id)initWithError:(NSError *)error;
- (UIAlertView *)alert;
@christophercliff
christophercliff / Makefile
Created December 14, 2012 00:19
Makefile for deploying a Wintersmith static site to Github Pages without exposing the source (assumes you're using the default build directory).
deploy:
rm -rf ./build
wintersmith build
cd ./build && \
git init . && \
git add . && \
git commit -m "Deploy"; \
git push "git@github.com:{YOUR NAME}/{YOUR REPO}.git" master:gh-pages --force && \
rm -rf .git
@kristopherjohnson
kristopherjohnson / contentsOfDirectoryAtPath.swift
Last active November 15, 2017 18:11
Using NSFileManager contentsOfDirectoryAtPath in Swift, with tuple result and CPS interfaces
import Foundation
// Tuple result
// Get contents of directory at specified path, returning (filenames, nil) or (nil, error)
func contentsOfDirectoryAtPath(path: String) -> (filenames: String[]?, error: NSError?) {
var error: NSError? = nil
let fileManager = NSFileManager.defaultManager()
let contents = fileManager.contentsOfDirectoryAtPath(path, error: &error)
/*
ericasadun.com
Sometimes letting go doesn't mean saying goodbye
*/
prefix operator ++
prefix operator --
postfix operator ++