Skip to content

Instantly share code, notes, and snippets.

@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
@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')
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() {
function identity(a) {
return a;
}
/* @flow */
type IdentityFunc<A> = (a: A) => A;
declare var identity: IdentityFunc<number>;
const aNumber:number = identity(1);
const aString:string = identity("foo");
/* @flow */
type IdentityFunc<A> = (a: A) => A;
declare var identity: IdentityFunc<mixed>;
const aNumber:number = identity(1);
const aString:string = identity("foo");
/* @flow */
type IdentityFunc = <A>(a: A) => A;
declare var identity: IdentityFunc;
const aNumber:number = identity(1);
const aString:string = identity("foo");
@pcardune
pcardune / redux_v3.x.x.jsx
Last active April 27, 2017 08:43
This gist shows how to add support for redux-thunk and redux-promise-middleware to the flowtype libdefs for redux
// flow-typed signature: ba132c96664f1a05288f3eb2272a3c35
// flow-typed version: c4bbd91cfc/redux_v3.x.x/flow_>=v0.33.x
declare module 'redux' {
/*
S = State
A = Action
0x775fC81CBa62045E37987074B5C5675D42357ec0
0xfc45546bB62A57EbC96536fb8B58A0beb6c6cD44