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 / 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 / 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 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 / 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 / theD.txt
Created May 31, 2016 11:44
comment: Give it the D
___ _____
/ _ \ ______ ______ ______ ______ ______ ______ ______| __ \
| (_) |______|______|______|______|______|______|______| | | | /\//\/
> _ < ______ ______ ______ ______ ______ ______ ______| | | | /\//\/
| (_) |______|______|______|______|______|______|______| |__| |
\___/ |_____/
@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 / json2csvfile.js
Created April 19, 2016 15:28
js: Json file to CSV file converter
var converter = require('json-2-csv');
var fs = require('fs');
fs.readFile('Vonbismark.json', 'utf8', function (readError,readData) {
if (readError) {
return console.log(readError);
}
var dataArray = JSON.parse(readData);
// console.log(dataArray.length);
@thehig
thehig / rdpdc.bat
Last active May 20, 2016 10:42
RDP Disconnect
C:\Windows\System32\tscon.exe %sessionname% /dest:console
@thehig
thehig / .bash_profile
Last active December 14, 2015 14:52 — forked from gwing33/.bash_profile
My git shortcuts in my ~/.bash_profile
# Git Shortcuts
alias g='git'
alias gs='git status'
alias gst='git status -sb'
alias ga='git add'
alias gau='git add -u' # Removes deleted files
alias gp='git pull'
alias gpu='git push'
alias gc='git commit -v'
alias gca='git commit -v -a' # Does both add and commit in same command, add -m 'blah' for comment
@thehig
thehig / .gitconfig
Last active July 6, 2021 10:38
git: gitconfig aliases
[alias]
# Show last commits in nice format
last = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=relative
# https://stackoverflow.com/questions/17195861/undo-git-update-index-assume-unchanged-file#17195901
hide = update-index --assume-unchanged
unhide = update-index --no-assume-unchanged
# https://stackoverflow.com/questions/2363197/can-i-get-a-list-of-files-marked-assume-unchanged#37083903
unhide-all = update-index --really-refresh
hidden = !git ls-files -v | grep \"^[a-z]\"