This file contains hidden or 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 urllib2 | |
import csv | |
def retrieve_data(url): | |
file = urllib2.urlopen(URL) | |
reader = csv.DictReader(file) | |
data = [] | |
for row in reader: | |
data.append(row) |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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" : { |