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
#!/usr/bin/env python3 | |
from time import sleep | |
from urllib.parse import urlencode | |
import subprocess as sp | |
import httplib2 | |
import json | |
import sys | |
import re |
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
#!/usr/bin/env python3 | |
import sys, re, os | |
from itertools import chain | |
# Maps various currency signs to their names. | |
# TODO: collect keys from this to build the currency regex. | |
CURRENCY_MAP = {'$': 'dollars', '£': 'pounds', '€': 'euro'} | |
# Maps certain suffixes with to full word equivalents | |
EXPONENT_MAP = {'b': 'billion', 'm': 'million', 'k': 'thousand', 't': 'trillion'} |
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
(function($){ | |
// Declare the class | |
function Drawer($el, edge){ | |
console.log('Drawer(%s)', edge); | |
this.$el = $el; | |
this.edge = edge; | |
this._edgeType = (function(edge){ | |
if(edge === 'top' || edge === 'bottom'){ | |
return 'h'; | |
} else { |
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
#!/usr/bin/env python | |
# vim: et:ts=4:sw=4 | |
import random, pyglet | |
from pyglet.gl import * | |
from numpy import array | |
from scipy.spatial import Delaunay | |
N_POINTS = 200; | |
SCALE = 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Object.observe</title> | |
</head> | |
<body> | |
<h1 reactive>Title here</h1> | |
<p reactive>Text here</p> | |
<hr /> | |
<p><b>Hey!</b> Open up the console and change the <tt>title</tt> |
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
from urllib.parse import parse_qs | |
from itertools import islice | |
def get_colors_from_kuler(kuler_url, count=5): | |
"""Get colors from a Adobe Kuler/Color CC URL. | |
You can't easily export these colour schemes, since the only | |
save feature Adobe implemented uses the Adobe account. However, | |
raw color values are stored in the URL in a somewhat unwieldy | |
but still straightforward format. Basically, |
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
The MIT License (MIT) | |
Copyright (c) 2015 Filip Wieland | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
function serialiseAll(object) { | |
var properties = Object.getOwnPropertyNames(object); | |
var plainObject = _.reduce(properties, function(obj, prop) { | |
obj[prop] = object[prop]; | |
return obj; | |
}, {}); | |
return JSON.stringify(plainObject); | |
} |
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> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<title>Brian Blessed demo</title> | |
<style type="text/css"> | |
.out { | |
font-weight: bold; | |
} | |
body { |
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
// Psy Shell v0.4.4 (PHP 5.6.4-4ubuntu6.2 — cli) by Justin Hileman | |
>>> function foo($x) { return $x * 2; } | |
=> null | |
>>> foo(5) | |
=> 10 | |
>>> is_callable(foo) | |
PHP error: Use of undefined constant foo - assumed 'foo' on line 1 | |
>>> is_callable('foo') | |
=> true | |
>>> 'foo'(5) |
OlderNewer