Skip to content

Instantly share code, notes, and snippets.

View thehig's full-sized avatar

David Higgins thehig

  • Dublin, Ireland
View GitHub Profile
@thehig
thehig / meteor.log
Created May 19, 2016 15:23
meteor: entity too large
2016-05-13 16:02:31+01:00Error: request entity too large
2016-05-13 16:02:31+01:00 at makeError (/app/bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/node_modules/raw-body/index.js:154:15)
2016-05-13 16:02:31+01:00 at readStream (/app/bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/node_modules/raw-body/index.js:188:15)
2016-05-13 16:02:31+01:00 at getRawBody (/app/bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/node_modules/raw-body/index.js:95:12)
2016-05-13 16:02:31+01:00 at read (/app/bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/lib/read.js:64:3)
2016-05-13 16:02:31+01:00 at [object Object].jsonParser (/app/bundle/programs/server/npm/node_modules/meteor/iron_router/node_modules/body-parser/lib/types/json.js:116:5)
2016-05-13 16:02:31+01:00 at packages/iron_router/lib/router.js:277:1
2016-05-13 16:02:31+01:00 at [object Object]._.extend.withValue (packages/meteo
@thehig
thehig / theD.txt
Created May 31, 2016 11:44
comment: Give it the D
___ _____
/ _ \ ______ ______ ______ ______ ______ ______ ______| __ \
| (_) |______|______|______|______|______|______|______| | | | /\//\/
> _ < ______ ______ ______ ______ ______ ______ ______| | | | /\//\/
| (_) |______|______|______|______|______|______|______| |__| |
\___/ |_____/
@thehig
thehig / twotap-javascript-pls.js
Last active May 31, 2016 15:24
js: twotap set all docs to JavaScript
/* Press Ctrl-A then Ctrl-J to one-line the code below */
var item = document.querySelectorAll('div.code-tabs > div.ng-scope.tab > a > span');
for (var i = 0; i < item.length; i++) {
var current = item[i];
if(!current || !current.innerText) continue;
if(current.innerText === "JavaScript"){
current.click();
}
}
@thehig
thehig / playbackrate.js
Created June 7, 2016 20:14
js: playbackrate
/*
Locate all video elements on a page and attempt to set their playback rate to 2.0
Convert to single line using Sublimes Ctrl-A Ctrl-J
*/
(function(global){
var elems = document.getElementsByTagName("video");
for(var i = 0; i<elems.length; i++){
try {
var elem = elems[i];
elem.playbackRate = 2;
@thehig
thehig / fixture_sinon_wrapper.js
Last active July 4, 2016 11:47
js: sinon-fixture-wrapper
module.exports = function(url, payload, outputLevel){
// Uncomment to disable the wrapper
// return {
// restore: function(){}
// }
var sinon = require('sinon');
fakeServer = sinon.fakeServer.create();
fakeServer.autoRespond = true;
@thehig
thehig / playbackrate.js
Created June 10, 2016 12:09
bookmarklet: playbackrate
javascript: /* Locate all video elements on a page and attempt to set their playback rate to 2.0 Convert to single line using Sublimes Ctrl-A Ctrl-J */ (function(global){var elems = document.getElementsByTagName("video"); for(var i = 0; i<elems.length; i++){try {var elem = elems[i]; elem.playbackRate = 1; } catch(e){/*no-op*/ } } })(this);
javascript: /* Locate all video elements on a page and attempt to set their playback rate to 2.0 Convert to single line using Sublimes Ctrl-A Ctrl-J */ (function(global){var elems = document.getElementsByTagName("video"); for(var i = 0; i<elems.length; i++){try {var elem = elems[i]; elem.playbackRate = 1.5; } catch(e){/*no-op*/ } } })(this);
javascript: /* Locate all video elements on a page and attempt to set their playback rate to 2.0 Convert to single line using Sublimes Ctrl-A Ctrl-J */ (function(global){var elems = document.getElementsByTagName("video"); for(var i = 0; i<elems.length; i++){try {var elem = elems[i]; elem.playbackRate = 2; } catch(e){/*no-op*/ } } })(thi
@thehig
thehig / data_driven_test.spec.coffee
Created June 22, 2016 14:44
coffee: Data driven test
# This is a test snippet that will iterate over a collection of expected values, and compare them against the test values
describe "option 2", ->
it "has 5 observableValues", -> expect(product.required_fields[1].observableValues).to.have.length(5)
somoText = (text, i) -> it "[" + i + "] text '" + text + "'", -> expect(product.required_fields[1].observableValues[i]).to.have.property('text', text)
somoText(item, i) for item, i in ["Color: Snow", "Color: Sky Blue", "Color: Gray Granite", "Color: Soft Pink", "Color: Light Lemon"]
[
// https://forum.sublimetext.com/t/quick-switch-project-shortcut-doesnt-work-anymore/17261/6
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" }
]
@thehig
thehig / deleteSlack.js
Created July 26, 2016 18:14
js: Automate slack message deletion
/*Works on Slack Archive Page*/
function delNext(delay, cb){
console.log("Starting delete");
/*Click Delete*/
document.querySelector('#batch_delete_link').click();
setTimeout(function(){
/*Click All*/
document.querySelector('#batch_delete_div > p:nth-child(3) > a:nth-child(2)').click();
setTimeout(function(){
/*Click Delete*/
@thehig
thehig / strobe-led.ino
Created August 4, 2016 14:36
arduino: photocell controlled led strobe
// CONST's
int DS_pin = 8;
int STCP_pin = 9;
int SHCP_pin = 10;
int NUM_LED = 8;
// 8 LED Registers
boolean registers[8];
// Direction of LED travel
boolean goingUp = true;