Skip to content

Instantly share code, notes, and snippets.

View jbenet's full-sized avatar

Juan Benet jbenet

View GitHub Profile
#!/usr/bin/env python
import os
from subprocess import Popen
from subprocess import PIPE
cmd = ["git", "log", "--shortstat", '--pretty=format:commit %an']
proc = Popen(cmd, stdout=PIPE)
@jbenet
jbenet / UIControl+CaptureUIControlEvents.h
Created August 8, 2010 09:00
UIControl Category to capture and save UIControlEvents flag to its own tag
// The MIT License
//
// Copyright (c) 2010 Juan Batiz-Benet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@jbenet
jbenet / Framework.sh
Created February 19, 2011 17:17
setup a static framework from iphoneos and iphonesimulator static libs
#!/bin/sh
#
# Framework.sh -- static iOS framwork packager
#
# This script combines two static libs (iphoneos and iphonesimulator) into one,
# and then packages it into a static, app-store friendly, framework.
# A chosen configuration is also packaged into a tarball for easy releases :)
#
# Original Script by Pete Goodliffe
# from http://accu.org/index.php/journals/1594
@jbenet
jbenet / NSTimeZone+AskGeo.h
Created April 7, 2011 11:27
Objective-C AskGeo API
// The MIT License
//
// Copyright (c) 2010 Juan Batiz-Benet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@jbenet
jbenet / zipf.py
Created May 19, 2011 23:12
Zipf Distribution python module (counts text occurrences)
#!/usr/bin/env python
# The MIT License
#
# Copyright (c) 2011 Juan Batiz-Benet
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@jbenet
jbenet / current_utc_time.c
Created July 17, 2011 16:17
work around lack of clock_gettime in os x
/*
author: jbenet
os x, compile with: gcc -o testo test.c
linux, compile with: gcc -o testo test.c -lrt
*/
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
@jbenet
jbenet / basic.py
Created September 8, 2011 12:34
datastore api
class Datastore(object):
'''A Datastore represents storage for serialized dronestore versions.
Datastores are general enough to be backed by all kinds of different storage:
in-memory caches, databases, a remote cache, flat files on disk, etc.
The general idea is to wrap a more complicated storage facility in a simple,
uniform interface, keeping the freedom of using the right tools for the job.
@jbenet
jbenet / fix_mail_keyboard_shortcuts.rb
Created September 19, 2011 02:11 — forked from indirect/fix_mail_keyboard_shortcuts.rb
fix Mail keyboard shortcuts containing > in Lion
#!/usr/bin/env ruby
require 'rubygems'
require 'cfpropertylist'
# This is a fix for the bug filed as Radar #1288404 with Apple.
# http://openradar.appspot.com/radar?id=1288404
# So, in Snow Leopard, I always set up Mail.app to have keyboard shortucts
# for my "From" email addresses. You can create your own in the Keyboard
# system preference pane by entering your email address (like "Andre Arko
@jbenet
jbenet / TeXchat.md
Created January 23, 2012 05:57
d.ocks.org markdown test

TeXchat

About

TeXchat is a simple web chat service that renders TeX math.

The goal is to make it trivially easy to have a conversation with someone else in the web, using mathematical symbols.

Currently, the prettiest math rendering is TeX math, which

@jbenet
jbenet / gist:1777302
Created February 9, 2012 04:29
Backbone EditableText Component
define([
'jquery',
'underscore',
'backbone',
'handlebars',
'ich',
'util/resource',
'order!libs/bootstrap/bootstrap-twipsy',
'order!libs/bootstrap/bootstrap-popover',