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
| //Location: 1 happy: 65401 sad: 33 | |
| //Location: 2 happy: 406 sad: 139 | |
| //Location: 3 happy: 65386 sad: 7 | |
| putHappinessScore({location: 3, happiness: 65386, unhappiness: 7}); |
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
| /** | |
| * Utility class to convert between geo-locations and Cartesian screen coordinates. | |
| * Can be used with a bounding box defining the map section. | |
| * | |
| * (c) 2011 Till Nagel, tillnagel.com | |
| */ | |
| public class MercatorMap { | |
| public static final float DEFAULT_TOP_LATITUDE = 80; | |
| public static final float DEFAULT_BOTTOM_LATITUDE = -80; |
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
| javascript:function%20iprl5(){var%20d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...)%20'+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/naC26SvnD0ky?u='+encodeURIComponent(l.href)+'&t='+(new%20Date().getTime()));b.appendChild(z);}catch(e){alert('Please%20wait%20until%20the%20page%20has%20loaded.');}}iprl5();void(0) |
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
| # Klout scores | |
| klouts <- read.csv("klout-scores.csv", header=TRUE) | |
| # Radiuses for rendering bubbles | |
| radius <- sqrt( klouts$klout_score / pi ) | |
| # Competitor matrix | |
| competitors <- read.csv("competitors.csv", header=TRUE) | |
| # Co-ords for plotting competitors |
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
| # See: http://www.ibm.com/developerworks/linux/library/l-tip-prompt/ | |
| export PS1="\[\e[35;1m\]\w \[\e[36;1m\]\u\[\e[32;1m\]$ \[\e[0m\]" |
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
| ######################################## | |
| ##### upstart_virtualenv_test.conf ##### | |
| ##### install in /etc/init ##### | |
| ######################################## | |
| description "Testing virtualenv and upstart setup" | |
| env PYTHON_HOME=/home/steve/.virtualenvs/upstart-test | |
| start on runlevel [2345] |
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
| #!/usr/bin/env python | |
| """ | |
| Computing the distance between two locations on Earth from coordinates | |
| The following code returns the distance between to locations based on each point's longitude and latitude. The distance returned is relative to Earth's radius. To get the distance in miles, multiply by 3960. To get the distance in kilometers, multiply by 6373. | |
| Latitude is measured in degrees north of the equator; southern locations have negative latitude. Similarly, longitude is measured in degrees east of the Prime Meridian. A location 10° west of the Prime Meridian, for example, could be expressed as either 350° east or as -10° east. | |
| via http://www.johndcook.com/python_longitude_latitude.html |
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
| #!/usr/bin/env python | |
| """ | |
| Joins a bunch of CSVs, sends the single joined CSV to STDOUT | |
| """ | |
| import codecs, csv, sys | |
| try: | |
| import cStringIO as StringIO |
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
| var source = "STRESS"; | |
| var target = "stress_locations"; | |
| var map = function () { | |
| if (this.tweet.user.location.trim()) { | |
| emit(this.tweet.user.location, 1); | |
| } | |
| }; | |
| var reduce = function(key, values) { |
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
| #!/usr/bin/env python | |
| """ | |
| Convert special characters in text to HTML entities. | |
| NOW WITH ADDED UNICODE SUPPORT! | |
| Usage: | |
| $ echo "<b>foo <i>bar</i></b>" | htmlescape.py | |
| """ |