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
SimplGy /
Created May 8, 2015
Backs up your dropbox folder recursively and incrementally to a file named by the month and year. Meant to run as a cron job.
echo "Starting Dropbox Backup"
echo "-----------------------"
echo `date`
cd ~
mkdir -p "Dropbox Backups"
echo "Archiving './Dropbox' to 'DropBox Backups/Dropbox_YEAR-MM).zip'.."
SimplGy / facebookMessengerSpam.js
Created May 20, 2015
Let's say a friend sends you 184 icons to spam you. Here's a script to send them back. Just pop open the avatar selection window in facebook and drop in the id of the one you want to spam them with.
View facebookMessengerSpam.js
var id = 1530358597204949; // the id of the dom node that has the icon you want
var makeItStopDannySelvag = setInterval(function(){
var node = document.querySelectorAll('[data-id="'+ id +'"]')[0];
$n = $(node);
}, 500);
SimplGy / createColoredIconImage.swift
Created Aug 19, 2015
Create a colored version of an existing UIImage in swift. Great for coloring icons.
View createColoredIconImage.swift
class Icon {
// Create a colored version of an existing image. Great for coloring icons.
// @param name of the image in your bundle
// @param color of the image to return
static func createColoredVersionOfImageNamed(name: String, color: CGColor) -> UIImage {
let img = UIImage(named: name)!
let rect = CGRect(origin: CGPointZero, size: img.size)
UIGraphicsBeginImageContextWithOptions(rect.size, false, img.scale)
let context = UIGraphicsGetCurrentContext()
SimplGy / twoWaysToTestVars.js
Created Apr 3, 2012
Comparison of two ways to check for bad data in a method
View twoWaysToTestVars.js
//------------------ Option A: Use if else to avoid execution of bad data
// panelData = {
// title: "a title for the panel (optional)"
// subtitle: "subtitle for the panel (optional)"
// contents: "panel contents (required)"
// }
_addPanel = function (panelData) {
var $panel
, panelPos
SimplGy / infiniteBacon-finished.html
Last active Oct 8, 2015
An infinite scroller built with Bacon using FRP techniques
View infiniteBacon-finished.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>FRP Infinite Scroll using Bacon.js</title>
<script src="//"></script>
<script src="//"></script>
<style type="text/css">
body {
View John Papa Style Guide
  • Single Responsibility -- one thing per file
  • IIFE -- free from coffeescript
  • Modules -- declare once, nest namespaces
  • Controllers -- name your fns, use controllerAs, vm = this, public methods at top of file
  • Services -- delegate all possible behavior to here for easier testing
  • Factories -- api up top, use promises for data calls
  • Data Services
  • Directives
  • Resolving Promises for a Controller
  • Manual Annotating for Dependency Injection
SimplGy / currencyDisplayAsEnum.swift
Last active Oct 11, 2015
Playing around with enums and computed properties as a way to display formatted values in Swift. Usage: `let sek = Currency.Code(rawValue: "SEK"); print(sek.display("42.50")`
View currencyDisplayAsEnum.swift
class Currency {
static private let decimals: [Code: Int] = [
Code.None: 0,
Code.DKK: 2,
Code.GBP: 2,
Code.NOK: 2,
Code.SEK: 2,
Code.USD: 2,
Code.XBT: 2
View post-receive.rb
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy ( and it's awesome
# - Ryan Florence (
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
SimplGy / runner.js
Created Feb 28, 2013
Updated PhantomJS QUnit runner to support RequireJS and CurlJS modules, which can load *after* QUnit.done is called. Also improved the console output and added a global timeout. If your test suite takes longer than `timeLimit` to run, it'll fail.
View runner.js
* QtWebKit-powered headless test runner using PhantomJS
* PhantomJS binaries:
* Requires PhantomJS 1.6+ (1.7+ recommended)
* Run with:
* phantomjs runner.js [url-of-your-qunit-testsuite]
* e.g.
Date.prototype.addHours = (h) ->
date = new Date @
date.setHours @getHours() + h
Date.prototype.isWeekday= ->
weekdays = [1..5] # Javascript days are integers from 0-6 starting at Sunday
_.contains weekdays, @.getDay()
You can’t perform that action at this time.