- 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Aside from removing Ruby on Rails specific code this is taken verbatim from | |
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome | |
# - Ryan Florence (http://ryanflorence.com) | |
# | |
# 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'] == '.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>FRP Infinite Scroll using Bacon.js</title> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.53/Bacon.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.7.0/lodash.min.js"></script> | |
<style type="text/css"> | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
$n.click(); | |
}, 500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Starting Dropbox Backup" | |
echo "-----------------------" | |
echo `date` | |
cd ~ | |
mkdir -p "Dropbox Backups" | |
echo "Archiving './Dropbox' to 'DropBox Backups/Dropbox_YEAR-MM).zip'.." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>FRP Infinite Scroll using Bacon.js</title> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.53/Bacon.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.7.0/lodash.min.js"></script> | |
<style type="text/css"> | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
networksetup -listpreferredwirelessnetworks en0 | wc -l |