Skip to content

Instantly share code, notes, and snippets.

View mimming's full-sized avatar

Jen Tong mimming

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mimming on github.
  • I am mimming (https://keybase.io/mimming) on keybase.
  • I have a public key ASAuA5qMjyOqQ04I2r128Vy39o6ifHH-pgHFOSAXXWQhZAo

To claim this, I am signing this object:

import unittest
class Calculator():
def add(x, y):
return x + y
class TestCaculator(unittest.TestCase):
def test_add(self):
self.assertEqual(Calculator.add(4, 4), 8)
@mimming
mimming / create-user-echo-token.html
Created May 31, 2015 00:49
create firebase user, echo token (for use in REST API)
<html>
<head>
<style>
body {
max-width: 800px;
}
ul#chat-buffer {
list-style: none;
padding-left: 0;
}
@mimming
mimming / a-sad-sort.php
Last active August 29, 2015 14:11
PHP wat
$foo = array(-1, NULL, 0, NULL, 0, NULL, -1);
echo "unsorted\n";
print_r($foo);
sort($foo);
echo "sorted once\n";
print_r($foo);
@mimming
mimming / gist:45f58e608e8a4d84b634
Last active August 29, 2015 14:09
Facebook and Twitter auth with redirects
<html>
<head>
<script src="https://cdn.firebase.com/js/client/2.1.2/firebase.js"></script>
<script src="https://code.jquery.com/jquery-2.1.0.min.js"></script>
<script>
$( document ).ready(function() {
var myFirebaseRef = new Firebase("https://test-firebase-please-ignore.firebaseio.com/");
$("#authFacebook").click(function(event) {
myFirebaseRef.authWithOAuthRedirect("facebook", function(error) {
@mimming
mimming / Directory structure
Last active August 29, 2015 14:09
Inserting a non-ascii character into Firebase
pom.xml
src/main/java/com/firebase/repro/Main.java
@mimming
mimming / rename-firebase-key.js
Created September 18, 2014 00:15
Rename a key in firebase across many nodes
var ref = new Firebase("https://<your-firebase>.firebaseio.com/path-to-your-node");
ref.on("child_added", function(snap) {
var data = snap.val();
data.phonenumber = data.contact;
delete data.contact;
ref.child(snap.name()).set(data, function(error) {
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); }
});
});