Skip to content

Instantly share code, notes, and snippets.

View philikon's full-sized avatar

Philipp Weitershausen philikon

View GitHub Profile
@philikon
philikon / email2username.py
Created June 14, 2011 18:54
Convert email address to Sync username
#!/bin/env python
import base64
import hashlib
import sys
if len(sys.argv) < 2:
print >>sys.stderr, "Usage: %s <email address>" % sys.argv[0]
sys.exit(1)
email = sys.argv[1].lower()
@philikon
philikon / prebound.html
Created July 12, 2011 18:15
Prebound JS methods
<!DOCTYPE html>
<html>
<head>
<script type="application/javascript;version=1.7">
/**
* Proxy handler to automatically bind methods.
*/
function prebound(obj) {
return {
class WebSocketImage extends React.Component {
state = {
blob: null,
};
componentDidMount() {
let ws = this.ws = new WebSocket(...);
ws.binaryType = 'blob';
ws.onmessage = (event) => {
if (this.state.blob) {