A Pen by Rob Anderson on CodePen.
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
/* | |
* AngularJS Countdown Timer Directive | |
* Author: Rob Anderson @iotaweb | |
* Dependencies: https://github.com/EvanHahn/HumanizeDuration.js | |
* Example: <span countdown class="pull-right" prefix="Token expires in" expires="{{ token.expiresAt }}"></span> | |
*/ | |
(function () { | |
'use strict'; |
This file contains hidden or 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
/* | |
Extended Angular logging | |
Author: Rob Anderson (@iotaweb) | |
Adds ability to turn on/off all logging messages | |
Adds abiity to specify logging levels | |
Adds support for console.table() | |
Adds support for using controller name (or alias) as context | |
Prepends logs with timestamp (nicely padded) | |
Doesn't mess with array (preserves nascent string substitution), e.g. $log.info('This is a %s', message) | |
Nicely formatted for easy reading (context padded to consistent width [optional]) |
This file contains hidden or 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
//! gravatarImageService | |
.factory('gravatarImageService', function(md5) { | |
return { | |
getImageSrc: function(value, size, rating, defaultUrl, secure) { | |
// convert the value to lower case and then to a md5 hash | |
var hash = md5.createHash(value.toLowerCase()); | |
var src = (secure ? 'https://secure' : 'http://www') + '.gravatar.com/avatar/' + hash + '?s=' + size + '&r=' + rating + '&d=' + defaultUrl; | |
return src; | |
} | |
}; |
This file contains hidden or 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
/* | |
* http://kevin.vanzonneveld.net | |
* original by: Webtoolkit.info (http://www.webtoolkit.info/) | |
* namespaced by: Michael White (http://getsprink.com) | |
* tweaked by: Jack | |
* improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
* input by: Brett Zamir (http://brett-zamir.me) | |
* bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
* depends on: utf8_encode | |
* example 1: md5('Kevin van Zonneveld'); |
This file contains hidden or 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
/** | |
* | |
* Base64 encode / decode | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
.factory('Base64', function() { | |
// private property | |
var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; |
This file contains hidden or 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/sh | |
CWD=$(cd $(dirname $0); pwd) | |
echo "This script will create a local riak cluster for development purposes only." | |
echo "Prerequisites: install riak using homebrew (tested with v1.3.1)." | |
echo "The cluster will be created in the current directory." | |
echo "Riak admin is enabled with no security.\n" | |
read -p "Enter a name for your cluster [cluster]: " name |
This file contains hidden or 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
/* | |
This library was developed by Will Honey. | |
It is licensed under the GPLv3 Open Source License | |
This library requires the underscore library found at http://documentcloud.github.com/underscore/ | |
This library requires the underscore string library found at http://edtsech.github.com/underscore.string/ | |
This library requires the support of localStorage. Updates could be easily made to change that. | |
*/ | |
/* jslint adsafe: false, devel: true, regexp: true, browser: true, vars: true, nomen: true, maxerr: 50, indent: 4 */ |