Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map = null;
function initializeMap() {
$.getJSON("http://www.ombord.info/api/jsonp/position/?callback=?", function(gpsData) {
var currentPosition = new google.maps.LatLng(gpsData.latitude, gpsData.longitude);
map = new google.maps.Map(document.getElementById("map_canvas"), {
@jdtoy
jdtoy / lat,lng,timezone
Created July 20, 2012 16:08
timezone detection database, from geoname 15000.txt
42.50729 1.53414 Europe/Andorra
42.50779 1.52109 Europe/Andorra
25.56473 55.55517 Asia/Dubai
25.78953 55.9432 Asia/Dubai
25.33132 56.34199 Asia/Dubai
25.25817 55.30472 Asia/Dubai
25.61955 56.27291 Asia/Dubai
25.35731 55.4033 Asia/Dubai
24.11028 52.73056 Asia/Dubai
25.11641 56.34141 Asia/Dubai
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
Or like:
{% if condition %} print {%=object.something %}{% endif %}
This, of course, completely screws up Django templates,
@jdtoy
jdtoy / tree.md
Created June 5, 2013 12:04 — forked from hrldcpr/tree.md
One-line Tree in Python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

#!/bin/bash -eux
# pkgs
apt-get update
apt-get upgrade -y
apt-get install -y curl git-core
# chef
which chef-solo >/dev/null || \
curl -L http://www.opscode.com/chef/install.sh | bash
/**
* Fetching data from BigQuery and present it in our sheet
* Author: Ido Green
* Date: 14/12/2013
*
* See: http://wp.me/pB1lQ-19i
* Misc: https://developers.google.com/bigquery/
*/
//
import math
from dbfpy import dbf
import matplotlib.pyplot as plt
#create a plot
fig = plt.figure(1, figsize = [10,10], dpi=90)
axScatter = plt.subplot(111)
def candMedian(dataPoints):
#Calculate the first candidate median as the geometric mean
function FBshares(url) {
var jsondata = UrlFetchApp.fetch("http://graph.facebook.com/"+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.shares;
}
function Tweets(url) {
var jsondata = UrlFetchApp.fetch("http://urls.api.twitter.com/1/urls/count.json?url="+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.count;
@jdtoy
jdtoy / neo4j_cypher_cheatsheet.md
Created January 12, 2019 11:01 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
@jdtoy
jdtoy / rpi4.boot-from-sd-rootfs-on-usb.md
Created October 16, 2020 20:50 — forked from lucabelluccini/rpi4.boot-from-sd-rootfs-on-usb.md
Raspberry Pi 4 - Boot from SD, Rootfs on USB

Raspberry 4B - Boot from SD and rootfs on USB

  1. Download Raspbian from the official site

  2. Flash it to the USB drive following the procedure detailed here

  3. Fomat an SD Card 2/4 GB as FAT32, label "boot", flag "lba". Generate a UUID. You can use GParted for this task.

  4. Get the UUID of the USB drive and the SD Card partitions using sudo blkid.