Skip to content

Instantly share code, notes, and snippets.

View JnBrymn's full-sized avatar

John Berryman JnBrymn

View GitHub Profile
@JnBrymn
JnBrymn / index.html
Last active October 2, 2015 18:28
My attempt to add templating to d3.js
<!DOCTYPE html>
<html>
<head>
<title>appendNodeFace</title>
<script src="http://mbostock.github.com/d3/d3.v2.js" type="text/javascript"></script>
<!--<script src="d3.v2.js" type="text/javascript"></script>-->
<script src="https://raw.github.com/andyet/ICanHaz.js/master/ICanHaz.min.js" type="text/javascript"></script>
<!--<script src="ICanHaz.min.js" type="text/javascript"></script>-->
<style type="text/css">
circle {
@JnBrymn
JnBrymn / appendNode_faceExample.html
Created April 3, 2012 20:14
attempting to add templating to d3.js
<!DOCTYPE html>
<html>
<head>
<title>appendNodeFace</title>
<script src="http://mbostock.github.com/d3/d3.v2.js" type="text/javascript"></script>
<!--<script src="d3.v2.js" type="text/javascript"></script>-->
<script src="https://raw.github.com/andyet/ICanHaz.js/master/ICanHaz.min.js" type="text/javascript"></script>
<!--<script src="ICanHaz.min.js" type="text/javascript"></script>-->
<style type="text/css">
circle {
@JnBrymn
JnBrymn / index.html
Last active October 6, 2015 03:17
Pacifist Asteroids. Click on the ship and control it with W,A,S,D keys. No bullets, no enemies, no fighting.
<!DOCTYPE html>
<html>
<head>
<title>Asteroids</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="asteroids.js" charset="utf-8"></script>
<script type="text/javascript">
Space = function(params /*{width, height}*/) {
this.width = params.width;
@JnBrymn
JnBrymn / says_example.sh
Created July 31, 2012 02:08
Creating Suggest As You Type for Solr
#!/usr/bin/env bash
#this is how to create suggest as you type for finding a name (searching over last and first names)
#the search is only issued upon 3 characters or more because too many results will come back otherwise. This is a search for "tho" which could be Thomas (a first name) or Thompson (a last name).
curl "http://localhost:8983/solr/select?indent=on&qf=first_name%20last_name&defType=edismax&facet=truel&facet.field=first_name&facet.field=last_name&facet.mincount=1&fl=first_name%20last_name&q=tho*&facet.prefix=tho"
#as soon as a space is issued notice the change in the facet.prefix
curl "http://localhost:8983/solr/select?indent=on&qf=first_name%20last_name&defType=edismax&facet=truel&facet.field=first_name&facet.field=last_name&facet.mincount=1&fl=first_name%20last_name&q=thomas+&facet.prefix="
public class WimpySwanQParserPlugin extends QParserPlugin {
@Override
public void init(NamedList args) {
//if you need it!
}
public class WimpySwanQParser extends QParser {
public WimpySwanQParser(String qstr, SolrParams localParams,
SolrParams params, SolrQueryRequest req) {
super(qstr, localParams, params, req);
}
public class WimpySwanParser extends BaseParser<SpanQuery> {
int MAX_PARAGRAPH_LENGTH = 5000;
int MAX_SENTENCE_LENGTH = 500;
public class WimpySwanParser extends BaseParser<SpanQuery> {
public Rule Query() {
return Sequence(OrExpression(),EOI);
}
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 SwanQueries {
static int MAX_PARAGRAPH_LENGTH = 5000;
static int MAX_SENTENCE_LENGTH = 500;