Skip to content

Instantly share code, notes, and snippets.

View whroman's full-sized avatar

Walter H. Roman whroman

View GitHub Profile
javascript: (function() {
var root = $(document.getElementsByTagName('html'));
var watchers = [];
var attributes = [];
var attributes_with_values = [];
var elements = [];
var elements_per_attr = [];
var scopes = [];
@whroman
whroman / extendDatePrototype.js
Created May 1, 2014 00:01
Extending Javascript's Date.prototype
Date.prototype.getDayofYear = function(){
var d= new Date(this.getFullYear(), 0, 0);
return Math.floor((this-d)/8.64e+7);
}
Date.prototype.addDays = function (n) {
var year = this.getFullYear();
var month = this.getMonth();
var date = this.getDate() + n;
newDate = new Date(year, month, date);
@whroman
whroman / batchPaths.js
Last active August 29, 2015 14:00
DRY up your file-include-intensive scripts with batchPaths.js. Use cases include Grunt and Gulp task declarations.
var batchPaths = function() {
var _prefix = '';
var _suffix = '';
// _all (Array)
// Populated by calling batchPaths.add(Array).
var _all = [];
// Method: prefix
// Args: toPrefix (String)
//==== SCSS mixin to create CSS triangles
//==== Examples:
//==== @include triangle ("up", #fff, 10px, 20px);
//==== @include triangle("up", #000, 20px);
@mixin triangle ($direction: "down", $color: #000, $width: 20px, $height: $width ) {
width: 0;
height: 0;
border-left: #{setTriangleSide($direction, "left", $width, $height, $color)};
border-right: #{setTriangleSide($direction, "right", $width, $height, $color)};
border-bottom: #{setTriangleSide($direction, "down", $width, $height, $color)};