This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import math | |
import base64 | |
import bz2 | |
import gzip | |
import StringIO | |
import struct | |
class BitSetEncoder(object): | |
def encode(self, integers): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X GET "http://localhost:9200/licence-finder/_search?pretty=true" -d '{"query":{"query_string":{"query":"title.autocomplete:organ*"}},"sort":[{"title.sortable":"asc"}]}' | |
{ | |
"took" : 72, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'http://govuk:8983/solr/licence-finder/select?q=autocomplete%3Amanag%2A&wt=ruby&qt=standard&rows=5&start=0&fl=title%2Clink%2Cformat&indent=on' | |
{ | |
'responseHeader'=>{ | |
'status'=>0, | |
'QTime'=>0, | |
'params'=>{ | |
'fl'=>'title,link,format', | |
'indent'=>'on', | |
'start'=>'0', | |
'q'=>'autocomplete:manag*', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
table = pandas.read_csv("my_data.csv") | |
series = table[table['field1'] == "field1-value"]["field2"] | |
# now how do I get the first value in `series`? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def has_t(key) | |
t(key, throw: true) | |
true | |
rescue | |
false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type="text/css"> | |
body { | |
padding: 10px; | |
} | |
h1 { | |
font-family: Ariel; | |
font-size: 15px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greet_me("Rob") | |
Hello, Rob | |
greet_me("Mum") | |
Hello, Mum | |
greet_me("Prime Minister") | |
Hello, Prime Minister |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greet_me("Rob") | |
Hello, Rob | |
Hello, Rob | |
Hello, Rob | |
greet_me("Mum") | |
Hello, Mum | |
Hello, Mum | |
Hello, Mum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = "Robert" | |
print(name[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greet_me("Rob") | |
Hello, Rob | |
Hello, Rob | |
Hello, Rob | |
greet_me("Mum") | |
Hello, Mum | |
Hello, Mum |