Skip to content

Instantly share code, notes, and snippets.

function FBReady( func ) {
// If facebook is already loaded,
// just call the function
if ( FBReady.done ) return func();
// If the stack already exists,
// push the function onto it,
// otherwise, initialize a stack
// of functions
@mmhan
mmhan / fb_decode.php
Created April 25, 2011 02:33
A useful class to retrieve SignedRequest from a Facebook App embedded as tab in a Facebook Page. Particularly useful in finding out visiting user's ID and whether the user like the page or not.
<?php
/*************************************
* Class with methods to decode a signed request easily, for App embedded as Tab on a profile page.
*
* @ModifiedBy Mike - @mmhan - mmhan.net
* @author Nathron
* @url http://nathrondevblog.blogspot.com/2010/09/how-to-get-user-id-in-profile-tab.html
*
* @usage:
* //In facebook tab page.
@mmhan
mmhan / feeds.sh
Last active August 29, 2015 13:57
curl --header 'Content-Type: application/json' \
--header 'Snit-Session: <skey>' \
http://localhost:3000/feed/<epoch>
curl --header 'Content-Type: application/json' \
--header 'Snit-Session: <skey>' \
http://localhost:3000/feed/0
curl --header 'Content-Type: application/json' \
--header 'Snit-Session: SNIT_SESSION_KEY' \
http://<api_url>/feed/mine
@mmhan
mmhan / test.sh
Last active August 29, 2015 13:57
curl -X POST \
--header 'Content-Type: application/json' \
-d '{"ph":"0912345678","nick":"","name":"Thar Htet","email":"bla@gmail.com","pwd":"12345678"}' \
http://localhost:3000/sign_up
The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in.
sleep_in(False, False) → True
sleep_in(True, False) → False
sleep_in(False, True) → True