Skip to content

Instantly share code, notes, and snippets.

View thejefflarson's full-sized avatar
👨‍👩‍👧‍👦
being a dad

Jeff Larson thejefflarson

👨‍👩‍👧‍👦
being a dad
View GitHub Profile
var extend = function(obj){
var others = [].slice.call(arguments,1);
others.forEach(function(other){
for(var j in other) obj[j] = other[j];
});
return obj;
}
var Node = function(value){
this.value = value;
@thejefflarson
thejefflarson / Javascript Tokenizer
Created January 13, 2010 17:04
Tokenize javascript
function(script){
var tokens = function(string){
var curr_pos = string,
from = 0, // character position of the start of the new token in the string
i = 0, // current position
length = string.length, // total length of the string
tks = [], // collection of tokens
line = 1, // line number we're currently on
tokenizer = function(regex, fn){
/* USAGE
var graph = new Graph(paper.get(0), 800, 500);
graph.max(maxx, maxy)
.min(minx, miny)
.ticks(4, function(x, y){
var attrs = {stroke: "#ffffff", 'stroke-width': '1'};
graph.hor(y, attrs)
.ver(x, attrs);
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <gdal/ogrsf_frmts.h>
#include <geos_c.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/create_straight_skeleton_from_polygon_with_holes_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K ;
// Table.js is a small library for manipulating NxN arrays.
// It takes an NxN array and a list of type formatters by column headers so:
// var table = new Table([['one', 'two', 'three'], ["1","jeff larson","3px"]], {
// one : function(it) { return +it; },
// two : function(it) { return it.toUpperCase(); },
// three : function(it) { return +it.replace("px", ''); }
// });
//
var Table = function(data, types){
this.data = data;
$(function(){
$("#article-big-image").replaceWith($("<div/>").attr({"id": "map-cont"}).html([
'<img id="background" src="//www.propublica.org/projects/migration-map/images/background.png">'
, '<img class="year year-1890" src="//www.propublica.org/projects/migration-map/images/1890.png" style="display: block;">'
, '<img class="year year-1900" src="//www.propublica.org/projects/migration-map/images/1900.png">'
, '<img class="year year-1910" src="//www.propublica.org/projects/migration-map/images/1910.png">'
, '<img class="year year-1920" src="//www.propublica.org/projects/migration-map/images/1920.png">'
, '<img class="year year-1930" src="//www.propublica.org/projects/migration-map/images/1930.png">'
, '<img class="year year-1940" src="//www.propublica.org/projects/migration-map/images/1940.png">'
, '<img class="year year-1950" src="//www.propublica.org/projects/migration-map/images/1950.png">'
@thejefflarson
thejefflarson / train.py
Created April 4, 2020 01:59
Captcha solver
from tensorflow.keras import Input, Model
from tensorflow.keras.models import load_model
from tensorflow.keras.layers import (
Conv2D,
Activation,
MaxPooling2D,
Dropout,
Flatten,
Dense,
)
/* USAGE:
$(function(){
var steps = new Stepper("#steps");
steps.addSlide(1, function(){ this.canvas.text("slide 1"); });
steps.addSlide(2, function(){ this.canvas.text("slide 2"); });
steps.go();
});
*/

Keybase proof

I hereby claim:

  • I am thejefflarson on github.
  • I am thejefflarson (https://keybase.io/thejefflarson) on keybase.
  • I have a public key ASAOCcrYOEybgCz32LXRx9GKWVql6FI2-BVOfali5Qf_Ago

To claim this, I am signing this object:

createEngine((err, engine) => {
if (err) throw err;
engine.scan(buffer, (err, result) => {
if (err) throw err;
console.log(result);
});
});