Skip to content

Instantly share code, notes, and snippets.

Avatar

William Laffin libliflin

  • PwC
  • Kensington, Maryland
View GitHub Profile
@libliflin
libliflin / make_sql.cmd
Created Jul 29, 2016
Pull 616 Example SQL statements from the oracle 10g documentation.
View make_sql.cmd
@echo off
del examples-*
setlocal enableDelayedExpansion
rem wget -r -np https://docs.oracle.com/cd/B14117_01/server.101/b10759/statements_9014.htm#SQLRF01604
rem sift-tool.org
rem gnuwin32
rem sublime
rem lots of stackoverflow answers.
View pljson-micro-benchmark.sql
-- 211ms
-- sample taken from and tweaked:json.org/example.html
DECLARE
l_t clob;
l_json json;
BEGIN
l_t := '{"web-app": {
"servlet": [
{
"servlet-name": "cofaxCDS",
@libliflin
libliflin / JSON.parse-mico-benchmark.js
Last active Jun 29, 2016
7135; 74ms for 1000 passes.
View JSON.parse-mico-benchmark.js
var t = "{\"web-app\": {\n" +
" \"servlet\": [ \n" +
" {\n" +
" \"servlet-name\": \"cofaxCDS\",\n" +
" \"servlet-class\": \"org.cofax.cds.CDSServlet\",\n" +
" \"init-param\": {\n" +
" \"configGlossary:installationAt\": \"Philadelphia, PA\",\n" +
" \"configGlossary:adminEmail\": \"ksm@pobox.com\",\n" +
" \"configGlossary:poweredBy\": \"Cofax\",\n" +
" \"configGlossary:poweredByIcon\": \"/images/cofax.gif\",\n" +
@libliflin
libliflin / Searcher.java
Created Apr 3, 2016
Everything on stackoverflow didn't really factor in having to do it for alot of different strings in a file > 2MB. And writing this was faster than learning lucene.
View Searcher.java
import java.util.*;
import java.util.function.Function;
/**
* // todo: not threadsafe
* // todo: could be faster with regards to TLBs
* // todo: could multi-thread the indexer.
* // todo: index all the things; not just whole words.
* // todo: if you index all the things; a prefix tree would probably help; ESPECIALLY with space.
* // todo: charsequence: what's that?
@libliflin
libliflin / convert.go
Created Mar 24, 2016
Convert oracle html grammars to antlr4
View convert.go
package main
import (
"errors"
"fmt"
"io/ioutil"
"os"
"regexp"
"strings"
)
@libliflin
libliflin / RAINBOW.go
Last active Dec 25, 2015
Not really a rainbow.
View RAINBOW.go
func RAINBOW() []color.Color {
const (
paletteSize = 256
)
var palette [paletteSize]color.Color
// 1 0 0 : RED 1 +
// 1 1 0 : YELLOW 0 -
// 0 1 0 : GREEN 2 +
// 0 1 1 : TEAL 1 -
// 0 0 1 : BLUE 0 +
@libliflin
libliflin / mithril_onerror.js
Last active Sep 15, 2017
Skip opening devtools when programming mithril
View mithril_onerror.js
/*
error method makes it so i don't have to open up dev tools to see what went wrong.
must be in different <script> from your app code.
I use it in combination with Auto Reload https://addons.mozilla.org/en-US/firefox/addon/auto-reload/?src=api
*/
window.onerror = function(msg, url, line, col, error) {
m.render(document,
m("html", [
m("body", [
m("table", [
@libliflin
libliflin / list.md
Last active Mar 24, 2016
Tools I use as a (Windows/Oracle) Java developer.
View list.md