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
from matplotlib import pylab # .exe install is on sourceforge | |
import numpy# easy_install numpy | |
from mpl_toolkits.basemap import Basemap # easy_install basemap | |
# functions to create some random data points and convert them to meters via the map projection | |
def create_points_in_lon_lat(N=10000): | |
return zip(numpy.random.standard_normal(N)*360, numpy.random.standard_normal(N) * 45) | |
def convert_lon_lat_points_to_meters_using_transform(points, tran): | |
# maybe there is a better way to get long/lat into meters but this works ok |
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
class AliasDelegateMethodOntoSelfApproach(object): | |
def __init__(self): | |
self.bar = set() | |
self.__len__, self.add = self.bar.__len__, self.bar.add | |
foo = AliasDelegateMethodOntoSelfApproach() | |
foo.add(1) # Delegates to foo..add(), works fine | |
assert foo.bar != set([0]) # negative test | |
assert foo.bar == set([1]) # positive test |
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
# Note I haven't executed this code it's | |
# written from memory - its purpose is | |
# as an example. | |
from selenium import webdriver | |
wd = webdriver.Firefox() | |
# ... open a website etc. | |
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
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <windows.h> | |
typedef struct { | |
union { | |
bool bool_value; | |
int64_t int64_value; | |
double double_value; |
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 (latitude, longitude) -> str: | |
return 'do some magic!' | |
def (offset, limit) -> str: | |
return 'do some magic!' | |
def () -> str: | |
return 'do some magic!' |