Skip to content

Instantly share code, notes, and snippets.

View basilesimon's full-sized avatar

Basile Simon basilesimon

View GitHub Profile
@basilesimon
basilesimon / index.html
Created March 16, 2014 22:17
Popcorn Chain videos
<!DOCTYPE html>
<html>
<head>
<title>test popcorn player</title>
<meta charset="utf-8">
<script src="http://cdn.popcornjs.org/code/dist/popcorn-complete.js"></script>
<script src="https://raw.github.com/rwaldron/popcorn.sequence/master/popcorn.sequence.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.js"></script>
<!-- <script src="popcorn-chain.js"></script> -->
<!-- <script src="script1.js"></script> -->
var urls = ['put', 'your', 'page', 'urls', 'here'];
page.onConsoleMessage = function (msg) {
if(msg.indexOf('SCRAPE-RESULT:') >= 0) {
var fn = 'file_name_to_write_to.txt';
console.log('writing file', fn)
fs.write(fn, msg.replace('SCRAPE-RESULT:', ''), 'w');
}
@basilesimon
basilesimon / gist:bfe8cf74adde164ac437
Created May 14, 2014 20:01
Pancarte player syntax
// timecode is the points we got during the recording
// video is the video
var events = {
{
time: 4.0,
f: function() {
alert("We are at 4.0 in the video, and this fires.");
}
}, {
time: 8.0,
@basilesimon
basilesimon / index.html
Created May 21, 2014 17:28
Line chart with d3.js step 1
<!DOCTYPE html>
<html>
<head>
<title>Business quote demo</title>
<meta charset="utf-8">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="d3.js" charset="utf-8"></script>
<style>
body {
font: 12px sans-serif;
@basilesimon
basilesimon / base.json
Created June 13, 2014 12:41
What I've got
[
{
"cooccurrences": [
{
"label": "one",
"occurrence": "100",
"thing": "http://dbpedia.org/resource/Alex_Salmond"
},
{
"label": "linkedWithOne",
@basilesimon
basilesimon / result.json
Created June 13, 2014 12:42
What I need
{
"occurrences" : [
{
"label" : "one",
"thing" : "url_string",
"occurrence": 100
},{
"label" : "linkedWithOne",
"thing" : "url_string",
@basilesimon
basilesimon / collection.json
Created July 25, 2014 14:59
Police.uk API Postman collection
{
"id": "2e952df7-f894-48e4-1fb3-bc26dd3cac31",
"name": "Police.uk",
"description": "",
"order": [
"3727f908-a368-07d7-c707-5cd6be945bf6",
"17ea1b33-79fe-b2d3-68f6-3112b3160304",
"d14f413a-0756-b3c6-0a11-b99189bf5e1c",
"c73977b9-e3a5-25e6-659f-a4d03f255df9",
"a1aecba7-a85b-4043-1d54-7abf838cce45",
@basilesimon
basilesimon / data.json
Created August 29, 2014 17:30
GPS boundaries of London boroughs
{
"Barking and Dagenham": "51.517146,0.122688:51.523335,0.15648:51.514469,0.164677:51.530696,0.186926:51.554952,0.182242:51.565324,0.157149:51.561978,0.151963:51.563818,0.146276:51.575528,0.148618:51.582889,0.147614:51.596606,0.141591:51.597777,0.135904:51.598948,0.128543:51.588576,0.130383:51.579376,0.117335:51.561142,0.122354:51.555621,0.096592:51.543075,0.091908:51.54709,0.067484:51.540566,0.078023:51.528688,0.089231:51.524841,0.097763",
"Barnet": "51.677572,-0.190803:51.672052,-0.197495:51.672052,-0.196658:51.675063,-0.203517:51.676568,-0.212885:51.67339,-0.210878:51.668037,-0.220246:51.663855,-0.23045:51.659673,-0.249019:51.657498,-0.260561:51.638093,-0.271936:51.641606,-0.278461:51.633576,-0.302383:51.632907,-0.2982:51.623372,-0.271435:51.599785,-0.251026:51.585063,-0.257717:51.580379,-0.254037:51.573521,-0.250022:51.567164,-0.246844:51.57235,-0.240654:51.574692,-0.215729:51.553112,-0.200339:51.553112,-0.172904:51.574357,-0.169224:51.579041,-0.169726:51.586736,-0.160859:51.587405,-0.159019:51.590249
@basilesimon
basilesimon / listofpolys.json
Last active August 29, 2015 14:06
Datastringer example: Greater London crime stats
[
"51.517146,0.122688:51.523335,0.15648:51.514469,0.164677:51.530696,0.186926:51.554952,0.182242:51.565324,0.157149:51.561978,0.151963:51.563818,0.146276:51.575528,0.148618:51.582889,0.147614:51.596606,0.141591:51.597777,0.135904:51.598948,0.128543:51.588576,0.130383:51.579376,0.117335:51.561142,0.122354:51.555621,0.096592:51.543075,0.091908:51.54709,0.067484:51.540566,0.078023:51.528688,0.089231:51.524841,0.097763",
"51.677572,-0.190803:51.672052,-0.197495:51.672052,-0.196658:51.675063,-0.203517:51.676568,-0.212885:51.67339,-0.210878:51.668037,-0.220246:51.663855,-0.23045:51.659673,-0.249019:51.657498,-0.260561:51.638093,-0.271936:51.641606,-0.278461:51.633576,-0.302383:51.632907,-0.2982:51.623372,-0.271435:51.599785,-0.251026:51.585063,-0.257717:51.580379,-0.254037:51.573521,-0.250022:51.567164,-0.246844:51.57235,-0.240654:51.574692,-0.215729:51.553112,-0.200339:51.553112,-0.172904:51.574357,-0.169224:51.579041,-0.169726:51.586736,-0.160859:51.587405,-0.159019:51.590249,-0.163034:51.591755,-0.164038:51.6022
@basilesimon
basilesimon / test.py
Created January 13, 2015 21:00
THE SOLUTION
from bs4 import BeautifulSoup
from urllib2 import urlopen
BASE_URL = "http://www.chicagoreader.com"
def make_soup(url):
html = urlopen(url).read()
return BeautifulSoup(html, "lxml")
def get_category_links(section_url):