Skip to content

Instantly share code, notes, and snippets.

/* @flow */
type IdentityFunc<A> = (a: A) => A;
declare var identity: IdentityFunc<number>;
const aNumber:number = identity(1);
const aString:string = identity("foo");
function identity(a) {
return a;
}
import {connect} from 'react-redux';
// redux and react-redux are great! Let's create a connected component that looks up firstName in the state
// note that the age prop still needs to be supplied to ConnectedWhatsMyAgeAgain
const ConnectedWhatsMyAgeAgain = connect(
(state:{user:{name:string}}) => ({
firstName: state.user.name.split(' ')[0],
})
)(WhatsMyAgeAgain);
function App() {
@pcardune
pcardune / upload_photos.py
Created September 5, 2011 22:07
Script to upload a bunch of photos to facebook
#!/usr/bin/env python
import os
import os.path
import json
import re
from mimetypes import guess_type
from optparse import OptionParser
SUPPORTED_TYPES = ('image/gif','image/jpeg','image/png','image/bmp','image/tiff')
@pcardune
pcardune / feed_me.py
Created September 2, 2011 04:47
Authenticate with Facebook on the Command Line
#!/usr/bin/python2.6
import os.path
import json
import urllib2
import BaseHTTPServer
import webbrowser
from urlparse import urlparse, parse_qs
from urllib import urlencode