Skip to content

Instantly share code, notes, and snippets.

[1,2,3].map(x => x * x)
@jbalogh
jbalogh / README.md
Last active December 18, 2015 17:39
@jbalogh
jbalogh / gist:5155003
Created March 13, 2013 18:54
user style for humbughq.com
.message_list {
background-color: transparent !important;
}
.recipient_row {
border: none !important;
}
.recipient_row .left_part {
background-color: transparent !important;
}
@jbalogh
jbalogh / 1-simple.js
Created January 30, 2012 19:38
push notifications API
var notification = (navigator.notification ||
navigator.mozNotification ||
navigator.webkitNotification);
if (notification) {
// Ask the user to allow notifications.
var request = notification.requestRemotePermission();
request.onsuccess = function() {
var url = request.result;
console.log('New push URL: ' + url);
// We got a new push URL, store it on the server.
@jbalogh
jbalogh / amodeploy.py
Created May 19, 2011 19:06 — forked from oremj/amodeploy.py
amo deploy using commander
import os
from commander.deploy import hostgroups, local_command
AMO_DIR = "/data/amo_python/src/prod/zamboni"
_amo_dir = lambda *p: os.path.join(AMO_DIR, *p)
_git_lcmd = lambda ctx, c: ctx.local("/usr/bin/git %s" % c)
@jbalogh
jbalogh / django-tutorial.sh
Created April 8, 2011 03:00
Install all the tools you need to get playdoh set up.
# pip is a tool for installing Python packages.
sudo easy_install pip
# Essential tools for any self-respecting Python programmer.
sudo pip install virtualenv virtualenvwrapper ipython
# This is where we keep Python environments.
mkdir ~/.virtualenvs
# Set up our shell for virtualenvwrapper.
@jbalogh
jbalogh / _recommend.c
Created April 7, 2011 19:46
C extension for calculating addon recommendations
#include <Python.h>
PyObject *array, *ArrayType;
/* Specialized _symmetric_diff_count for array.array() objects.
* We get to skip all the GC and rich comparison functions since array()
* stores C types directly.
*
* This calculates len(set(xs).symmetric_difference(ys)) without the
* extra data structures in between. xs and ys must be sorted in
@jbalogh
jbalogh / nginx.conf
Created March 21, 2011 18:34
nginx.conf for serving glow
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
#!/usr/bin/env python
"""
Usage:
git log next..master --oneline | milestones.py
git cherry next master -v | milestones.py
Requirements:
pip install termcolor
@jbalogh
jbalogh / proxyproxy.js
Created November 9, 2010 18:27
node.js duplex proxy for load testing with production traffic
/* A node.js proxy that forwards requests to two upstream servers, but only
* returns the response from one. Might be useful for load testing with
* production traffic.
*/
var http = require('http');
/* The request is forwarded to both proxies, but only the response from proxy1
* is returned.
*/
var proxy1 = [8001, 'localhost'],