Skip to content

Instantly share code, notes, and snippets.

@tadast
tadast / countries_codes_and_coordinates.csv
Last active May 9, 2024 14:39
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude coordinates
Country Alpha-2 code Alpha-3 code Numeric code Latitude (average) Longitude (average)
Afghanistan AF AFG 4 33 65
Åland Islands AX ALA 248 60.116667 19.9
Albania AL ALB 8 41 20
Algeria DZ DZA 12 28 3
American Samoa AS ASM 16 -14.3333 -170
Andorra AD AND 20 42.5 1.6
Angola AO AGO 24 -12.5 18.5
Anguilla AI AIA 660 18.25 -63.1667
Antarctica AQ ATA 10 -90 0
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@matthewbednarski
matthewbednarski / postal-codes.json
Last active May 3, 2024 14:52
Global postal codes regex formats
[{ "Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", "Country": "Afghanistan", "ISO": "AF", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "With Finland, first two numbers are 22.", "Country": "Åland Islands", "ISO": "AX", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "Introduced in 2006, gradually implemented throughout 2007.", "Country": "Albania", "ISO": "AL", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "First two as in ISO 3166-2:DZ", "Country": "Algeria", "ISO": "DZ", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "U.S. ZIP codes (range 96799)", "Country": "American Samoa", "ISO": "AS", "Format": "NNNNN (optionally NNNNN-NNNN or NNNNN-NNNNNN)", "Regex": "^\\d{5}(-{1}\\d{4,6})$" }, { "Note":
@bertspaan
bertspaan / README.md
Created January 2, 2014 15:28
Python script to convert DBF database file to CSV
@JosefJezek
JosefJezek / eps-to-svg.md
Last active March 19, 2024 07:48
EPS to SVG Conversion using Inkscape

EPS to SVG using Inkscape Gittip

Author: Josef Jezek

# Install Inkscape on Ubuntu
sudo apt-get install inkscape
@matthewlehner
matthewlehner / autopgsqlbackup
Created July 11, 2012 16:10
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@abicky
abicky / gist:3052980
Created July 5, 2012 11:00
Create HTMLImageElement from HTMLCanvasElement and HTMLCanvasElement from HTMLImageElement
import "js/web.jsx";
class Util {
static function image2Canvas(image : HTMLImageElement) : HTMLCanvasElement {
var document = dom.window.document;
var canvas = document.createElement("canvas") as HTMLCanvasElement;
canvas.width = image.width;
canvas.height = image.height;
var ctx = canvas.getContext("2d") as CanvasRenderingContext2D;
ctx.drawImage(image, 0, 0);
@willrstern
willrstern / node-ubuntu-upstart-service.md
Last active August 17, 2023 10:15
Run Node.js App as Ubuntu Upstart Service

###The Issue With Forever Forever is great for running node services, with a minor setback: the word "forever" doesn't apply to system reboots.

###The solution, run node apps as a system service logged in as root

vim /etc/init/node-app.conf

Contents for node-app.conf

@rezigned
rezigned / README.md
Last active August 19, 2021 22:31
Simple deploy script

A simple script for deploy from git repository.

How it works

Assume we have the following project structures

$PROJECT_NAME:

Project name. This could be anything. for example sample

@4np
4np / ImageCaptureManager.swift
Created August 1, 2016 11:37
Example code to grab a still image (photo) from a mac's FaceTime camera
//
// ImageCaptureManager.swift
// ImageCapture
//
// Created by Jeroen Wesbeek on 29/07/16.
// Copyright © 2016 Jeroen Wesbeek. All rights reserved.
//
import Foundation
import AVFoundation