Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Benet jbenet

View GitHub Profile
View git-score
#!/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 Aug 8, 2010
UIControl Category to capture and save UIControlEvents flag to its own tag
View UIControl+CaptureUIControlEvents.h
// 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 Feb 19, 2011
setup a static framework from iphoneos and iphonesimulator static libs
View Framework.sh
#!/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 Apr 7, 2011
Objective-C AskGeo API
View NSTimeZone+AskGeo.h
// 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
Zipf Distribution python module (counts text occurrences)
View zipf.py
#!/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 Jul 17, 2011
work around lack of clock_gettime in os x
View current_utc_time.c
/*
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>
View basic.py
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 Sep 19, 2011 — forked from indirect/fix_mail_keyboard_shortcuts.rb
fix Mail keyboard shortcuts containing > in Lion
View fix_mail_keyboard_shortcuts.rb
#!/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 Jan 23, 2012
d.ocks.org markdown test
View TeXchat.md

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 Feb 9, 2012
Backbone EditableText Component
View gist:1777302
define([
'jquery',
'underscore',
'backbone',
'handlebars',
'ich',
'util/resource',
'order!libs/bootstrap/bootstrap-twipsy',
'order!libs/bootstrap/bootstrap-popover',