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
<div class='additional-product-content'> | |
<div class='nano-content-api' | |
data-apiurl="https://forms.nanodolphin.com/api/content-api/find?apiKey=<KEY HERE>&key=cashew-berry"> | |
</div> | |
</div> | |
<script> | |
jQuery(document).ready(function(){ | |
jQuery.each(jQuery('.nano-content-api'), function(api) { |
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 _ = require('lodash'); | |
module.exports = function(req, res, next) { | |
var parsed = {}; | |
_.each(req.body, function(val, key) { | |
var splits, i, last, currentKey; | |
if(!!~key.indexOf('.')) { | |
splits = key.split('.'); | |
last = parsed; | |
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
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.js'></script> | |
<script> | |
var mathy = function(init) { | |
return { | |
add: function add(x,y) { | |
return x + y; | |
}, | |
mult: function mult(x,y) { | |
return x * y; | |
}, |
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
// map, reduce, filter | |
l = [1,2,3,4] | |
l.collect { it + 1 } | |
//--> [2,3,4,5] | |
l.inject { l, n -> l + n } | |
//--> 10 | |
l.findAll { it % 2 == 0 } |
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
#first install all the things: | |
sudo apt-get install flac ffmpeg mp3splt libav-tools shntool | |
# Okay first lets do an MP3: | |
# input files: | |
# --> cd.ape | |
# --> cp.cue | |
# (there are other options, like bitrate, but this is just the bare bones) | |
avconv -i cd.ape cd.mp3 |
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
function RequiredComponent() { | |
this.setValA = (val) => { | |
// this will stay on the component | |
this.a = val; | |
} | |
} | |
RequiredComponent.prototype.setValB = function(val) { | |
// this will actually modify the container if you set the value to the method. |
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
import time | |
import math | |
import urllib2 | |
import json | |
import traceback | |
ser = None | |
MOUNT = "/dev/ttyACM0" #raspi | |
#MOUNT = "COM3" #windows | |
ENDPOINT = "http://api.wunderground.com/api/< API KEY >/forecast10day/q/OH/Cincinnati.json" |
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
const ConstContainer = { | |
add: (k,v) => { | |
if(ConstContainer.hasOwnProperty(k)) return false; | |
Object.defineProperty(ConstContainer, k, {value: v}); | |
}, | |
// format as array of arrays: [['key', 'value'], ['key', 'value']] | |
addMany: (arr) => { | |
arr.forEach((iter) => { | |
ConstContainer.add(iter[0], iter[1]); | |
}); |
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
function wrap(object, method, wrapper) { | |
var fn = object[method]; | |
return object[method] = function() { | |
return wrapper.apply(this, [fn.bind(this)].concat( | |
Array.prototype.slice.call(arguments))); | |
}; | |
} | |
wrap(console, 'log', function(original) { | |
var args = Array.prototype.slice.call(arguments); |
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
function deDupeArrayOfObjects(arr) { | |
var tmpMap = {}; | |
arr.forEach(function(val) { | |
var uniquekey = ''; | |
for(var k in val) { | |
if(val.hasOwnProperty(k) && val[k]) { | |
uniquekey += val[k].toString(); | |
} | |
} | |
tmpMap[uniquekey] = val; |