Skip to content

Instantly share code, notes, and snippets.

View kragen's full-sized avatar

Kragen Javier Sitaker kragen

View GitHub Profile
@kragen
kragen / README.md
Last active December 31, 2015 18:39 — forked from mbostock/.block

This page demonstrates a simple approximate algorithm for finding the closest point on any given SVG path element.

A coarse linear scan of the path provides an initial guess. Then, a binary search improves the guess to the desired level of precision (here, about 1px). To account for kinks in the path that can cause the binary scan to get stuck in a local minimum, the coarseness of the initial scan is dependent on the number of path segments. I doubt this algorithm is provably correct, but it seems to produce fairly good results even for the kinky path shown above. This technique is based on Mike Kamermans’ excellent Primer on Bézier Curves.

Knowing the closest path to a given point is useful for multi-line charts in the same way the Voronoi tessellation is useful for scatterplots: it makes it easier to select or highlight elements using the mouse. Instead of requiring the user to hover over a line

<?php
function basic_bs_register_settings() {
register_setting('basic_bs_settings_group', 'basic_bs_settings');
}
add_action('admin_init', 'basic_bs_register_settings');
$basic_bs_options = get_option('basic_bs_settings');
function business_tools_admin_menu() {
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""A DSL for making paths of interesting shapes.
Nick Johnson and Kragen Javier Sitaker
<https://gist.github.com/2555227>
"""
import math
@kragen
kragen / clases.md
Created February 22, 2012 03:36 — forked from Diex/clases.md
Unix - La Navaja del Ejercito Suizo

Primer curso de Escuela Newton. Serán 8 clases sobre los conocimientos mínimos necesarios para poder trabajar cómodamente en cualquier sistema operativo de la familia Unix (en particular Linux - Ubuntu) Dictado por Javier Sitaker. 8 Clases. Comienza el 5 de Marzo de 2012. Mas info: ....@mail.com

Resumen Del Curso

Lamentablemente, un montón de nuestros sistemas actuales Unix están en otro mundo, diferente del de las interfaces de Web y GUI que usamos cotidianamente --- un mundo subterráneo debajo del iPhone, Android, Kindle, Mac, casi todos los servidores, y los desktops de software libre. Éste curso te abre las puertas a todo ésto.

@kragen
kragen / club.md
Created January 5, 2012 01:25 — forked from anonymous/gist:1562923

Muchachos, soy Jorge, pegué el cuerpo del mail de Mateus haciendo el resumen de lo que hablamos. También un link muy interesante al final. Chequeen! abrz

En primer lugar, me parece que estamos acordados en dos puntos: vamos hacer una convocatoria cerrada para cerca de 15 personas, un grupo que debe incluir chicas (por favor). el segundo punto es que arrancaríamos en febrero, para aprovechar la baja temporada cultural y para empezar con la movida temprano en el año, incluso para generar programación en la casa abasto.

@kragen
kragen / kindrules.c
Created December 14, 2009 23:39 — forked from gian/kindrules.c
#include <stdio.h>
typedef int bool;
enum { true = 1, false = 0 };
/* dummy definitions to make it compile */
enum symbol { SYM_DONTCARE, SYM_ANY, SYM_OTHER };
enum kind { KIND_DONTCARE, KIND_NODE, KIND_OTHER };
sub maybe_add_worker {
if ( @threads < $daemon->options->{maxthreads} ) {
print "Creating new thread\n";
push @threads, threads->new(\&do_work);
}
}
sub remove_worker {
if ( @threads > $daemon->options->{minthreads} ) {
print "Removing thread\n";

Here are the top few things I learned about Git, mostly in the first few hours I used it. This is the document I wished I had had, on top of the various introductions floating around. Maybe it will be useful to somebody else.

  1. Git handles 400MB of HTML crawl data less gracefully than it handles 700K of Python. But it handles that data more gracefully than cp and rsync do.

  2. Don't git push to a repository that actually has a work area.