Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<table id="mytable">
</table>
<script>
var d = null;
$.ajax({
@giupo
giupo / gist:4130708
Created November 22, 2012 11:37
Python Singleton
## Metaclass for singletons
class Singleton(type):
def __init__(cls, name, bases, dict):
super(Singleton, cls).__init__(name, bases, dict)
cls.instance = None
def __call__(cls,*args,**kw):
if cls.instance is None:
cls.instance = super(Singleton, cls).__call__(*args, **kw)
@giupo
giupo / python_test.py
Created October 30, 2012 17:15
R-Python apples-to-apples tests
#
# I'm running the same tests described here : http://wesmckinney.com/blog/?p=268
#
from pandas import *
from pandas.util.testing import rands
n = 100000
indices = Index([rands(10) for _ in xrange(n)])