Skip to content

Instantly share code, notes, and snippets.

const getPosition = (position = 0) => {
return {
x: 0 + position,
y: 0 + position,
}
};
const parseMessages = (messages) => {
const parsedMessages = new Map();
const queue = [Object.values(messages).find(({tag}) => tag === 'labels-start')];
@jacksonhoose
jacksonhoose / Contract Killer 3.md
Created April 8, 2016 01:44 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

#!/bin/bash
NODE_VERSION=0.4.7
NPM_VERSION=1.0.94
# Save script's current directory
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#cd "${DIR}"
#
function BFS(root, callback){
var queue = [];
queue.push(root);
while(queue.length){
var current = queue.shift();
callback(current.value);
for(var i = 0; i < current.children.length; i++){
queue.push(current.children[i]);
}
@jacksonhoose
jacksonhoose / documentDistance.js
Last active August 29, 2015 14:12
documentDistance
// Original version by Erik D. Demaine on January 31, 2011,
// based on code by Ronald L. Rivest (see docdist[1-7].py).
// Usage:
// node documentDistance.js file1.txt file2.txt
// # This program computes the "distance" between two text files
// # as the angle between their word frequency vectors (in radians).
// #
// # For each input file, a word-frequency vector is computed as follows:
alphabet = function(charStart, charStop) {
charStart = charStart || 97;
charStop = charStop || 122;
var alphabet = [];
for(; charStart <= charStop; charStart++)
alphabet.push(String.fromCharCode(charStart))
return alphabet;
};
@jacksonhoose
jacksonhoose / gist:48d3c7601c3bbe4fa96b
Last active August 29, 2015 14:09
A nice way to vertically center content
<div class="auto-v-center">
<h2>Vertically Centered Stuff</h2>
<p>Indeed</p>
</div>
// scss
.auto-v-center {
@include inline-block(middle);
'use strict';
function LocationCtrl (resolvedLocation) {
this.locations = resolvedLocation;
}
LocationCtrl.resolve = {
resolvedLocation: function(Data) {
'use strict';
function LocationCtrl (locations) {
this.locations = locations.locations;
}
LocationCtrl.resolve = {
locations: function(Data) {
var checkBoxToggle = {
init: function() {
this.checkBoxes = $('#showUnread, #showArchived');
this.tableBodies = $('div.dashboard-table tbody');
this.bindChange();
},
bindChange: function() {
this.checkBoxes.on('change', this.changeEvent.bind(this));