Skip to content

Instantly share code, notes, and snippets.

View heneryville's full-sized avatar

Mitchell Harris heneryville

View GitHub Profile
import hmac
import hashlib
import base64
# Never hard-code secrets in public code
SECRET = bytes('DX5Q3XXaQ5VEGiW224Xwg5GLicKWGDw/+hw9YDYTCvk=', 'UTF8')
timestamp = '1635513507'
passed_signature = 'wnraKDv+Oh6FsBNtLt8c+Lp+L0CvFUnn4RZZFslteNw='
body = '{"events":[{"eventType":"XXX"}]}'
@heneryville
heneryville / invalid-harder.txt
Created July 13, 2017 22:21
Phone Double Pump to Turn On
[[[-0.8779873847961426,0.7216057777404785,1.596923828125,-0.765948474407196,-0.4953630864620209,0.18962284922599792],[-0.7234609127044678,0.9732487201690674,1.099081039428711,-0.521995484828949,-0.20986349880695343,0.1725780963897705],[-0.5195047855377197,0.8764044046401978,1.607452392578125,-0.5092119574546814,0.03622009605169296,0.12783563137054443],[-0.4691932201385498,1.1267707347869873,1.4713239669799805,-0.24395300447940826,0.16831691563129425,0.024501830339431763],[-0.5829195976257324,1.0717964172363281,1.1404857635498047,-0.10972558706998825,0.1289009302854538,-0.039415985345840454],[-0.68927001953125,0.9488076567649841,0.3149700164794922,0.05539543926715851,0.10120321065187454,-0.08628904819488525],[-0.9774196147918701,1.2898848056793213,0.06316661834716797,0.05219954997301102,0.1459456831216812,-0.07563608139753342],[-0.9291071891784668,1.0264278650283813,-0.13202571868896484,0.01811004802584648,0.11611736565828323,-0.06711370497941971],[-1.2309409379959106,1.053525686264038,-0.2612876892089844,-0.0
Just because it's technically possible, does that me we need it?
Imagine that you've got a magic box that can translate whatever people say and normalize so it's always the same. Would we use it? Many of the same arguments for linting could be used here
It makes us lazy. If we've got static analysis that tells us something about our code style, we don't put as much effort into reading it. But WE SHOULD.
But doesn't this prevent super bad code from getting submitted? Dr. Olsons reach over and smack them principle.
@heneryville
heneryville / gist:bc98b4886f25ce30e664f477f8af3332
Last active January 27, 2017 17:23
i18next interleaving race condition
"use strict";
var i18n = require('i18next');
const LanguageStrings = {
"en-GB": {
translation: {
"SAY_STUFF": "en-GB said"
}
},
{
"id": "2016",
"premiereDate": "2016-08-08T16:00:00.000Z",
"votingDate": "2016-11-08T16:00:00.000Z",
"finaleDate": "2016-11-15T16:00:00.000Z",
"logo": "http://placekitten.com/200/200",
"about": "On the 20s a house full of aspiring, twenty-something trainers will vie with one another to win a lucrative contract to create a Beachbody fitness program. Each contestant comes from a different fitness background, and each was chosen for his or her unique personanlity and potential to motivate others to get healthy and fit. Wehich one will have the spectial \"something\" it takes to be chosen? Your vote will help us decide. So you'll definitely want to tune in every week, and when it comes down to the finalists, <strong>-- we'll be couting on you to help us pick the next Beachbody Super Trainer!</strong>"
}
@heneryville
heneryville / OSXFails.md
Last active February 8, 2016 21:15
Things I hate about OSX
  • The priority for the path is backwards, causing hours of pain when installing VIM http://superuser.com/questions/7150/mac-os-x-conventional-places-where-binary-files-should-live/7163#7163

  • Brew isn't default. It requires XCode to install many things

  • The terminal is terrible. I've got to bring in a customer terminal to be any good (iTerm2)

  • Spotlight will not, just will not in any way, launch two instances of the same app. So I can't open two terminals without foolery

  • Because there are no installers (which is actually kinda nice) Apps I download need to be moved from /Downloads into someplace good lest I risk clobbering them the next time I clean

  • The OS has claimed many of the good key commands. Does command + H take me to my history in Chrome? No. It hides the screen.

  • Why does there need to be 3 meta keys? Command, control, and alt/option? Why do they have to be in a different order?

  • Two button mouse disabled by default. Why!!!! It may have made sense 20 years ago, but we know how to do this

@heneryville
heneryville / gist:e8d815a3a35c83f4fb8a
Last active August 29, 2015 14:25
Save stuff on angular onbeforeunload
angular.module('myapp')
.controller('MyController',['$rootScope',function($rootScope){
$rootScope.$on('beforeunload',function(){
//Save junk
});
}).factory('onunload',['$rootScope',function($rootScope){
window.onbeforeunload = function(e){ //Listen for events on the window
$rootScope.$apply(function(){ //If we didn't do this through $apply, there woudl be no digest cycle and changes to the DOM would show up late
$rootScope.$broadcast('beforeunload'); //Angular does pubsub via the $broadcast function available on scopes. $emit is similar
});