Skip to content

Instantly share code, notes, and snippets.

@eeejay
eeejay / distance.py
Created September 28, 2010 01:37
Get geographic distances
# A Pythonofication of http://www.bdcc.co.uk/Gmaps/BdccGeo.js
# Originally in Javascript by Bill Chadwick
import sys
import math
import re
from urllib import urlopen
import json
from pprint import pprint
import plistlib
#import <Foundation/Foundation.h>
@interface Coordinates : NSObject {
double _x;
double _y;
double _z;
}
+ (double)geocentricLatitude:(double)geographic_latitude;
+ (double)geographicLatitude:(double)geocentric_latitude;
Components.utils.import("resource://gre/modules/ctypes.jsm")
var liblog = ctypes.open('liblog.so');
var android_log = liblog.declare("__android_log_write",
ctypes.default_abi,
ctypes.int32_t,
ctypes.int32_t,
ctypes.char.ptr,
ctypes.char.ptr);
<html>
<body>
<a href="" id="bookmarklet">Bookmark this link</a>
<script>
function bookmarklet() {
var pid = /profile_id=(\d*)&/.exec(document.querySelector("[href*=\"profile_id=\"]").href)[1];
var uid = prompt("Paste here Facebook ID:", "ID");
if (((uid * 2) / 2) != uid) {
alert("Incorect number.");
halt;
identifier,file,Title,Alternative Title,Is Part Of,Creator,Creator URI,Earliest Date of Creator,Latest Date of Creator,Role of Creator,Culture of Creator,Gender of Creator,Description,Cultural Context,Keywords,Abstract,Producer,Director,Writer,Performers,Additional Credits,Date Created,Is Format Of,Original Format,Original Material,Original Measurements,Language,Current Location,Creation Location,Publisher,Relation,Rights,Type,Style Period,Genre,Format,Identifier
AEB_00024s2011,images/00024s2011.jpg,They,他们,,"Hai, Bo",http://lccn.loc.gov/no2007107125,1962,,photographers,Chinese,male,"In this series of photographs, Hai bo juxtaposes everyday studio phtographs-of family members, friends, or co-workers—from the Cultural Revolution with photographs of the same subjects staged in the same arrangement several decades later.",Chinese,Cultural Revolution; nostalgia; memory; uniform,,,,,,,1999,"Lin, Xiaodong 林晓东, ed.Yuwo youguan 与我有关 [About me] (Beijing: Other Shore Arts Inc.,2000)",photographs,,180 cm x 60 cm,,,,,,"T
// DOMContentLoaded is fired once the document has been loaded and parsed,
// but without waiting for other external resources to load (css/images/etc)
// That makes the app more responsive and perceived as faster.
// https://developer.mozilla.org/Web/Reference/Events/DOMContentLoaded
function getMessages() {
return new Promise((resolve, reject) => {
var x = new XMLHttpRequest();
var params = "m5_csrf_tkn=" + document.querySelector("meta[name=csrf_id]").content;
console.log(params);
@eeejay
eeejay / hosting_good.html
Last active June 21, 2019 01:46
Good Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Good Example</title>
<style>
body {
margin: 50px;
function showClientCoords(win, x, y, timeout=1000) {
let d = win.document.createElement("div");
d.style.width = "10px";
d.style.height = "10px";
d.style.borderRadius = "5px";
d.style.backgroundColor = "red";
d.style.position = "fixed";
d.style.top = (y + 5) + "px";
d.style.left = (x + 5) + "px";
win.document.documentElement.appendChild(d);
@eeejay
eeejay / index.html
Last active December 15, 2018 19:11
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no" />
<style>
html {
height: 100%;
width: 100%;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.