Skip to content

Instantly share code, notes, and snippets.

@tcrosen
tcrosen / .jshintrc
Created January 10, 2015 04:20
My default .jshint settings
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
@tcrosen
tcrosen / kimono-example.js
Last active December 11, 2016 01:24
Kimono Example
var moment = require('moment-range');
var request = require('request');
var _ = require('lodash');
var url = require('url');
var start = new Date(2014, 9, 8);
var end = new Date();
var range = moment().range(start, end);
// Gets boxscore links from scores page

I'm Having a Panic Attack

Don't worry, I'll be fine

  • Start telling me a story - anything to keep my mind from wandering
  • Don't be nervous - I managed to write this card, I'll be okay
  • Don't expect a reaction from me - but if I do talk or interact it's a good thing
  • Ask me something simple every few minutes - yes or no questions are good
  • If we're in public, don't make a scene - having more people around will make me nervous
@tcrosen
tcrosen / gist:41618192eb251ec25276
Last active August 29, 2015 14:08
Don't ignore Node error parameters. Silent errors cause lots of lost time.
// I was performing a simple update of a MongoDB object
// .update() doesn't return the data after execution
// Because I wasn't concerned with the return value from .update(),
// I foolishly forgot to add callback parameters to account for a possible error being returned.
// The result was a silent failure that was breaking my tests causing much frustration.
// bad
function savePerson(newPersonData, done) {
Person.findByEmail({ email: newPersonData.email ), function(err, person) {
if (err) { done(err); }
@tcrosen
tcrosen / terrible-angular
Created October 25, 2014 04:46
This is not how you write Angular code
var skatersuperstatsApp = angular.module('skatersuperstatsApp', ['ngRoute','ui.bootstrap']);
skatersuperstatsApp.controller('PlayerDataCtrl', function($scope, $http) {
$scope.showFilters=false;
$scope.showFilterText='Show Data Filters';
$scope.toggleShowFilters = function() {
if ($scope.showFilters) {
$scope.showFilters=false;

Keybase proof

I hereby claim:

  • I am tcrosen on github.
  • I am terry (https://keybase.io/terry) on keybase.
  • I have a public key whose fingerprint is 88B8 583B EBCB 4DCB 0F41 F6B9 8B50 EC21 1E11 B16E

To claim this, I am signing this object:

placeholder
/**
* Example of using an angular provider to build an api service.
* @author Jeremy Elbourn (jelbourn@google.com)
*/
/** Namespace for the application. */
var app = {};
/******************************************************************************/
@tcrosen
tcrosen / the_rock_fibonacci.js
Created August 14, 2012 04:25
If The Rock wrote Javascript
//
// IF YOU SMELLL...
//
var WHAT_THE_ROCK_IS_COOKIN = function THE_PEOPLES_FIBONACCI(IT_DOESNT_MATTER_WHAT_SIZE_YOU_WANT) {
var ONE = 0,
TWO = 1,
WHOS_NEXT, KO = 2,
THE_ROCK_SAYS = [ONE, TWO];
@tcrosen
tcrosen / Node.sublime-build
Created March 21, 2012 01:58
Sublime Text 2 Node.js Build System
{
"cmd": ["node", "$file_name"],
"selector": "source.js",
"working_dir" : "$file_path"
}