Skip to content

Instantly share code, notes, and snippets.

View lingo's full-sized avatar

Luke Hudson lingo

View GitHub Profile
{
"name": "fakeeh",
"version": "0.1.0",
"private": true,
"dependencies": {
"bcrypt": "^1.0.1",
"body-parser": "^1.17.2",
"express": "^4.15.4",
"jsonwebtoken": "^7.2.1",
"material-ui": "^0.19.0",
import React from 'react';
import ReactDom from 'react-dom';
import injectTapEventPlugin from 'react-tap-event-plugin';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import { browserHistory, Router } from 'react-router';
import routes from './routes.js';
// remove tap delay
injectTapEventPlugin();
@lingo
lingo / jscs.log
Created August 20, 2017 10:01
JSCS slow
$ time strace -e trace=open,close,read,write,connect,accept jscs file.js
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
close(3) = 0
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
close(3) = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
close(3) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
@lingo
lingo / checkArrowKeys.js
Last active June 6, 2017 08:51 — forked from anonymous/checkArrowKeys.js
Animated Knots key handling
// document.onkeydown=checkArrowKeys;
document.addEventListener('keydown', checkArrowKeys);
function checkArrowKeys(e) {
var evt = e ? e : event;
var mykey = evt.keyCode;
if ((mykey == 37) && (prevKnot > 1)) {
showButtons(ButtonFadeDelay);
elemQ = document.getElementById('Prelim'); // Get Identity
elemQ.style.zIndex = -2; // Hide Labelled Image If Showing
@lingo
lingo / SSViewer.patch
Created July 7, 2015 11:44
Patch SSViewer to help template debugging.
From ce4dafd211f5283e9c47cf42bbda93998f88ca65 Mon Sep 17 00:00:00 2001
From: Luke Hudson <lukeletters@gmail.com>
Date: Tue, 7 Jul 2015 13:44:03 +0200
Subject: [PATCH] DEBUG: Tag HTML with source templates
This can be used with a small script as follows to debug your
templates.
https://gist.github.com/lingo/11476ce245cb05aec543
---
@lingo
lingo / debugTpl.js
Last active August 29, 2015 14:24
Enable hover styles to display source template (requires patch to SSViewer)
/**
* This works with the patch here:
* https://gist.github.com/lingo/5fd432cfb70758907f85
*/
var style = document.createElement('style');
style.textContent =
'.sstemplate: hover {' +
@lingo
lingo / bookmarklet source
Created December 1, 2014 16:18
Trello Show Card numbers
/**
* To be used as a bookmarklet
* See: https://trello.com/c/PkIrgKzd/36-show-card-numbers
*/
(function(){
var e="display: inline-block !important; font-weight: bold; font-size: 16px; background: #E3E3E3; color: #0e74af; padding: 0.25em; border-radius: 5px 0 00; position: absolute; bottom: 0em; right: 0;";
$("<style>.card-short-id.hide {"+e+"}</style>").appendTo(document.head);
})();
var request = require('supertest-as-promised'),
Promise = require('bluebird'),
should = require('should');
var game = require('../game.js').app;
// Instead of assertScoreEquals, we now fetch the score
// and assert when the promise returns a value
var getScore = function() {
return request(game).get('/score').expect(200)
@lingo
lingo / test.log
Created August 5, 2014 18:34
superagent@0.18.2 npm test
> superagent@0.18.2 test /tmp/superagent
> make test
․․․․․․․․․․․․․․․double callback!
․double callback!
․double callback!
․double callback!
․double callback!
@lingo
lingo / gist:5e53d2cb5b282d53d912
Last active May 9, 2022 21:19
Separation of logic from request handlers
// mylogic.js
var MyLogic = {
_currentAccount: null,
fetchAccountByID: function(id) {
// fetch account from database, use promises to reject/resolve
},
setCurrentAccount: function(account) {
MyLogic._currentAccount = account;
}