Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
That’s good now double it again.

Luke Nezda nezda

🤠
That’s good now double it again.
View GitHub Profile
View example_query.graphql
{
page(url:"http://www.eventbrite.com/") {
title: text(selector:"title")
cards: query(selector:"div.poster-card") {
name: text(selector:"[itemprop=name]")
url: attr(selector:"meta[itemprop=url]", name:"content")
image_src: attr(selector:".js-poster-image", name:"src")
}
}
}
View ResultSetSpliterator.java
package test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import java.util.function.Consumer;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
@sorenmacbeth
sorenmacbeth / gist:1340665
Created Nov 4, 2011
The rest of our utility functions
View gist:1340665
(defn tokenizer-seq
"Build a lazy-seq out of a tokenizer with TermAttribute"
[^TokenStream tokenizer ^TermAttribute term-att]
(lazy-seq
(when (.incrementToken tokenizer)
(cons (.term term-att) (tokenizer-seq tokenizer term-att)))))
(defn load-analyzer [^java.util.Set stopwords]
(StandardAnalyzer. Version/LUCENE_CURRENT stopwords))
@rednaxelafx
rednaxelafx / Notes
Created May 29, 2011
Example of HotSpot's PrintCompressedOopsMode's output. It's clear that UseCompressedOops can only be used with heap size < 32GB
View Notes
The "size" field shows total reserved GC heap size in MB, which includes all generations (including PermGen).
"32-bits Oops" means the shift is zero; otherwise it'd be non-zero.
If UseCompressedOops is false, or if the heap is too big to use compressed oops, then PrintCompressedOopsMode won't print anything. The -Xmx32g example below show that ergonomics didn't set UseCompressedOops to true.
If the heap is too big, HotSpot would print a warning message and set UseCompressedOops to false.
@simonw
simonw / gist:7000493
Created Oct 15, 2013
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
View gist:7000493
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (
View automata.py
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state
@reborg
reborg / rich-already-answered-that.md
Last active Nov 30, 2021
A curated collection of answers that Rich gave throughout the history of Clojure
View rich-already-answered-that.md

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content