The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
| 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')]; |
| #!/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]); | |
| } |
| // 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; | |
| }; |
| <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)); |