Skip to content

Instantly share code, notes, and snippets.

Eric Miller SimplGy

Block or report user

Report or block SimplGy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@toolness
toolness / baconjs-infinite-scroll.html
Last active Aug 29, 2015
An attempt to implement infinite scrolling using Bacon.js, a Functional Reactive Programming (FRP) library.
View baconjs-infinite-scroll.html
<!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 Sep 29, 2011
expect(foo).toBeInstanceOf(Bar)
View spec_helper.coffee
# https://github.com/pivotal/jasmine/pull/70/files
jasmine.Matchers.prototype.toBeInstanceOf = (klass) ->
this.actual instanceof klass
View 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 Dec 19, 2015
Adds jQuery style getters and setters to a given constructor function.
View magicMethod.js
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)
}
View tyga.js
// Make it Nasty
function increment (i) {
i ^= (i & ~-~i) | (~i & -~i)
return i
}
View DeployingJavaScript.md

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.
View ErrorFormatter.h
#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 Dec 14, 2012
Makefile for deploying a Wintersmith static site to Github Pages without exposing the source (assumes you're using the default build directory).
View Makefile
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 Nov 15, 2017
Using NSFileManager contentsOfDirectoryAtPath in Swift, with tuple result and CPS interfaces
View contentsOfDirectoryAtPath.swift
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)
View nostalgia.swift
/*
ericasadun.com
Sometimes letting go doesn't mean saying goodbye
*/
prefix operator ++
prefix operator --
postfix operator ++
You can’t perform that action at this time.