Skip to content

Instantly share code, notes, and snippets.

View DanLuchi's full-sized avatar

Dan Luchi DanLuchi

View GitHub Profile
@DanLuchi
DanLuchi / gist:ff2c43e73904e2dc1215fe19d5876a0d
Last active May 23, 2016 17:03
Javascript Testing Issues
What are the issues
Jest tests with lots of things unmocked are really slow
Examples: (run `npm test`):
PASS app/assets/javascripts/shared/view_controllers/__tests__/book_story_comments_view_controller-test.coffee (47.683s)
PASS app/assets/javascripts/shared/components/__tests__/book_card-test.coffee (48.103s)
PASS app/assets/javascripts/shared/stores/__tests__/profile_signup_form_store-test.coffee (24.089s)
PASS app/assets/javascripts/shared/stores/__tests__/book_story_form_store-test.coffee (24.394s)
PASS app/assets/javascripts/shared/view_controllers/__tests__/create_book_story_button_view_controller-test.coffee (15.639s)
PASS app/assets/javascripts/features/profile/stores/__tests__/edit_profile_form_store-test.coffee (21.567s)
### Keybase proof
I hereby claim:
* I am danluchi on github.
* I am dluchi (https://keybase.io/dluchi) on keybase.
* I have a public key whose fingerprint is A1B3 426E 74A0 F31A 2936 A855 8C99 B6E3 4E56 B137
To claim this, I am signing this object:
If you're like me, you like Peanut M&Ms. If you're like me you also enjoy eating them two at a time and prefer if the two are the same color
If you're like me, you like Peanut M&Ms. If you're like me you also enjoy eating them two at a time and prefer if the two are the same color
@DanLuchi
DanLuchi / gist:44240b33b59dcc291402
Created December 11, 2015 20:59
API Best Practices
http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api
http://jsonapi.org/
@DanLuchi
DanLuchi / gist:404d84de4f18bc5d1e4c
Created September 30, 2015 12:05
Building Letterpress in React
Step 1: Board
2D array 5x5
value of each entry is a letter
Step 2: create game
initially randomize each letter
this will probably need to get more complicated later (like redo unless vowels > 3 or something)
game board is immutable
Step 3: Game State
@DanLuchi
DanLuchi / second_job.md
Last active September 29, 2015 00:44
Your Second Job

We didn't lie to you, but we weren't completely honest either. Its just a lot easier to pick one way to do things and stick to it than it is to explain all of the possible approaches with their tradeoffs.

You're starting your second job now and its going to be one of the most interesting times in your career. Its when you discover that there truly are an infinite number of ways to accomplish the same task. You'll probably find out that you have a pretty good handle on what to do, but not necessarily why you ought to do it that way.

Don't be too dogmatic. This is a tremendous opportunity to learn, both about new ways of doing things and also about the strengths and weaknesses of the approaches that you've been using. When you find yourself thinking "OMG, what the hell is this?", pause for a moment and try to figure out what the tradeoffs are: what could be some advantages to doing it this way? And ask a lot questions: "I see that you're using [tool A] instead of [tool B], why is that?" Maybe they'll have a g

/*
* robotMaze.js
*
* The blue key is inside a labyrinth, and extracting
* it will not be easy.
*
* It's a good thing that you're a AI expert, or
* we would have to leave empty-handed.
*/
@DanLuchi
DanLuchi / gist:dfa007233cb198d73bd1
Created June 27, 2015 15:52
Why We're Switching from jQuery to Tinder for our Datepicking Needs.

Today marks a major change in the direction of our project. We're switching from jQuery to Tinder for all date picking across our platform, effective immediately.

Making such a large change wasn't an easy descision. It means learning all new APIs and rewriting dozens of lines of code and possibly even some tests. We are almost certainly the largest standalone application to make this decision but this kind of bold decision making is exactly what got us to the top and its exactly what we need to keep us there.

We started using the jQuery Datepicker back in 2005. It was a different time, we were a small upstart company doing whatever it took to make a name for ourselves no matter how many friends we'd lose or companies we're leave dead and bloodied along the way, just so long as we could make a name for ourselves in the industry. jQuery Datepicker was the hot new technology on the block and it was exactly the kind of bleeding edge technology that we needed to disrupt our entrenched competition. The first few