Skip to content

Instantly share code, notes, and snippets.

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

- (void) socketIODidConnect:(SocketIO *)socket
{
NSLog(@"socket.io connected.");
SocketIOCallback cb = ^(id argsData) {
NSDictionary *response = argsData;
NSLog(@"%@",response);
# sanity heroku_env
#
# FIXME: Need a better way to 'prime' the app before doing a sanity check.
# When done, 503 should be removed from the set of valid http codes.
#
sanity() {
echo "Checking http://$1.herokuapp.com"
curl -s -S -L http://$1.herokuapp.com -o /dev/null -m 500 --retry 5 --retry-delay 8 -w '%{http_code}' \
| tee -a /tmp/heroku.out | grep -q '200\|401\|400\|503' || (echo "$1 deploy may have failed!" && exit 1)
}
@dougalcampbell
dougalcampbell / utfluv.js
Created March 12, 2012 19:44
Handle invalid JS character sequences
/**
* encode to handle invalid UTF
*
* If Chrome tells you "Could not decode a text frame as UTF-8" when you try sending
* data from nodejs, try using these functions to encode/decode your JSON objects.
*
* see discussion here: http://code.google.com/p/v8/issues/detail?id=761#c8
* see also, for browsers that don't have native JSON: https://github.com/douglascrockford/JSON-js
*
* Any time you need to send data between client and server (or vice versa), encode before sending,