Skip to content

Instantly share code, notes, and snippets.

View JnBrymn's full-sized avatar
🥔

John Berryman JnBrymn

🥔
View GitHub Profile
@JnBrymn
JnBrymn / neo performance test
Created March 21, 2014 12:56
This tests 3 different algorithms for insert a user with their friends.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
var crypto = require('crypto');
//varies from -1 t0 1
var pow2_31 = Math.pow(2,31);
var randNum = function(t,seed) {
var shasum = crypto.createHash('sha1');
return shasum.update(""+seed+t).digest().readUInt32LE(0)/pow2_31-1;
}
var randNumGenMaker = function(seed) {
@JnBrymn
JnBrymn / index.html
Last active December 26, 2015 00:09
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Slider - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JnBrymn
JnBrymn / SemanticAnalyzer.py
Created July 29, 2013 03:53
Spin up a Solr, ingest some documents, and then run Latent Semantic Analysis and auto generate related words for each of your documents. For instance, a document with "darth vader" will have generated words such as "anakin", "yoda", and "jedi".
import requests
from collections import deque
class SolrTermVectorCollector(object):
def __pathToTvrh(self, solrUrl, collection):
import urlparse
userSpecifiedUrl = urlparse.urlsplit(solrUrl)
schemeAndNetloc = urlparse.SplitResult(scheme=userSpecifiedUrl.scheme,
netloc=userSpecifiedUrl.netloc,
path='',
query='',
@JnBrymn
JnBrymn / SearchAsYouType.html
Created June 8, 2013 04:00
This is a demo search UI for demonstrating Search As You Type with Solr.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>search as you type</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<style>
public class SwanQueries {
static int MAX_PARAGRAPH_LENGTH = 5000;
static int MAX_SENTENCE_LENGTH = 500;
public class CalculatorParser extends BaseParser<Integer> {
public Rule Expression() {
return Sequence(
Term(),
ZeroOrMore(
FirstOf(
Sequence('+', Term(), push(pop() + pop())),
Sequence('-', Term(), push(pop(1) - pop()))
)
public class WimpySwanParser extends BaseParser<SpanQuery> {
public Rule Query() {
return Sequence(OrExpression(),EOI);
}
public class WimpySwanParser extends BaseParser<SpanQuery> {
int MAX_PARAGRAPH_LENGTH = 5000;
int MAX_SENTENCE_LENGTH = 500;