Skip to content

Instantly share code, notes, and snippets.

View file.js
[1,2,3].map(x => x * x)
@jbalogh
jbalogh / gist:5155003
Created Mar 13, 2013
user style for humbughq.com
View gist:5155003
.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 Jan 30, 2012
push notifications API
View 1-simple.js
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 — forked from oremj/amodeploy.py
amo deploy using commander
View amodeploy.py
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 Apr 8, 2011
Install all the tools you need to get playdoh set up.
View django-tutorial.sh
# 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 Apr 7, 2011
C extension for calculating addon recommendations
View _recommend.c
#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 Mar 21, 2011
nginx.conf for serving glow
View nginx.conf
#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;
View milestones.py
#!/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 Nov 9, 2010
node.js duplex proxy for load testing with production traffic
View proxyproxy.js
/* 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'],