Then install truffle
npm install --global truffle
Create metacoin example project
“ | |
” | |
’ |
// made this because I got tired of trying to scroll on a website that used this widget. | |
// only tested on node 10.1.0 | |
'use strict'; | |
var TINROOF_WIDGET_URL = 'https://www.reverbnation.com/widget_code/html_widget/venue_1008205?widget_id=52'; | |
var https = require('https'); | |
// allow optional `--json` arg to just display the json; | |
var handler = displayData; | |
if (process.argv[2] === '--json') { | |
handler = saveJson; |
var DB = {}; | |
function Base(data) { | |
for (var key in data) { | |
this[key] = data; | |
} | |
} | |
Base.prototype.save = function() { | |
DB[Math.random().toString()] = this.serialize(); | |
}; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Minimal bootstrap tab pane setup</title> | |
</head> | |
<style> | |
.tab-pane { | |
display: none; | |
} | |
.tab-pane.active { |
var dang = {dang: '', haha: '', whoops: undefined, whatever: false, hehe: [{what: '', lol: true, ok: false, wow: {haha: 'false', word: [], up: '', ok: false }, why: 0 }, null, 'lol' - 42] }; | |
function omitValuesRecursive(obj, omittedValues) { | |
var omittedValues = omittedValues || ['', undefined, null]; | |
if (window._) { | |
return scrubEmptyFieldsLodash(obj); | |
} | |
return scrubEmptyFields(obj); | |
// recursively remove omitted values from the object. modifies the original object | |
function scrubEmptyFields(obj) { |
$('body').prepend('<style>@keyframes spin {from {transform:rotate(0deg);} to {transform:rotate(359deg);} } @keyframes spinrev {from {transform:rotate(0deg);} to {transform:rotate(-359deg);} }</style>'); | |
$('body').click(function(event) { | |
event.preventDefault(); | |
//use event.target with firefox | |
var target = event.toElement || event.target; | |
var spin = (Math.random() < 0.5) ? 'spin' : 'spinrev'; | |
$(target).css('animation', spin + ' 4s infinite linear'); | |
}); |
Then install truffle
npm install --global truffle
Create metacoin example project
function findNearestMatches(data, target, windowSize) { | |
/* | |
* Find [windowSize] items closest to [target] value | |
* | |
* var arr = [0,1,2,3,4,5]; | |
* findNearestMatches(arr, 2, 3) | |
* -> [1,2,3] | |
* findNearestMatches(arr, -5, 4) | |
* -> [0,1,2.3] | |
*/ |
// requires jQuery https://code.jquery.com/jquery-1.11.3.js | |
window.events = []; | |
$('body').click(function(event) { | |
//use event.target with firefox | |
var selector = fromHTMLElement(event.toElement || event.target); | |
window.events.push(selector); | |
console.log(selector, $(selector)); | |
}); | |
function fromHTMLElement(srcElement) { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Demo</title> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="description" content="Demo project"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<style type="text/css"></style> |