Skip to content

Instantly share code, notes, and snippets.

View deecewan's full-sized avatar

David Buchan-Swanson deecewan

View GitHub Profile
@deecewan
deecewan / api.js
Created February 17, 2017 01:19
Proxies to easily make requests to an API
function wrapInProxy(target) {
return new Proxy(target, {
get: (target, name) => {
target.endpoint = target.endpoint || [];
const fn = (data) => dispatch => dispatch(makeRequest(name, target.endpoint.join('/'), data));
fn.endpoint = [...target.endpoint, name];
return wrapInProxy(fn);
}
});
}
@deecewan
deecewan / server.js
Created October 28, 2016 09:17
@ghiculescu beat me to it by 10 minutes 😥🚀💯
import Express from 'express';
let db = {};
const app = new Express();
app.post('/clear_data', (req, res) => {
db = {};
res.sendStatus(200);
});

Keybase proof

I hereby claim:

  • I am deecewan on github.
  • I am deecewan (https://keybase.io/deecewan) on keybase.
  • I have a public key whose fingerprint is BE67 AC11 5662 B306 2C21 84FE E304 77EF 73F6 6487

To claim this, I am signing this object:

/**
* This is a little, useless script that will highlight your Javadoc methods green when you click them.
* I made it because I kept looking at the wrong one when I was implementing it.
*
* Just copy and paste this into your browsers JS console. Changing tabs will break functionality. You'll have to redo it
*/
[].forEach.call(document.querySelectorAll('h3'), function(tag){
if (tag.parentNode.tagName == 'LI'){
var theUl = tag.parentNode.querySelectorAll('ul.blockList, ul.blockListLast');
document.addEventListener('keydown', function(e){
if (e.ctrlKey || e.metaKey){
if (String.fromCharCode(e.which).toLowerCase() != 's') return;
e.preventDefault();
console.log('Trying to save');
}
});
@deecewan
deecewan / test.js
Created March 12, 2016 11:38
console.slack tests
var slack = require('./console-slack');
slack.options = {
webhook : '<redacted>',
channel : '#testing-ground',
}
console.slack('Hello, World!', '#testing-ground', function(resp, status){
console.slack("Response is: " + resp);
console.slack("Status is: " + status);