Skip to content

Instantly share code, notes, and snippets.

@jamesbar2
jamesbar2 / postal-codes.json
Last active March 29, 2025 19:30 — forked from matthewbednarski/postal-codes.json
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",
@marcgg
marcgg / notevalues.json
Created November 1, 2016 10:56
note frequency value
var noteValues = {
'C0': 16.35,
'C#0': 17.32,
'Db0': 17.32,
'D0': 18.35,
'D#0': 19.45,
'Eb0': 19.45,
'E0': 20.60,
'F0': 21.83,
'F#0': 23.12,
@Restuta
Restuta / framework-sizes.md
Last active April 19, 2025 05:14
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@nolanlawson
nolanlawson / wishlist.md
Last active May 3, 2021 11:51
Safari IndexedDB/WebSQL bug wishlist

Safari IndexedDB/WebSQL bug wishlist

Big overview of what's missing in Safari 7.1+ and iOS 8+ in terms of browser storage.

Updated May 25th 2016

Safari (general)

<?php
/*
* OpenExpedio ("xPDO") is an ultra-light, PHP 5.2+ compatible ORB (Object-
* Relational Bridge) library based around PDO (http://php.net/pdo/).
*
*
* This plugin is part of xPDO.
*
* xPDO is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
@christianseel
christianseel / introRTE
Created August 14, 2014 14:52
RTE for introtext #modx
<?php
// Add RTE for introtext if richtext option is enabled for the resource
// check "OnDocFormRender" event
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() {
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext");
});</script>');
@amdbuilder
amdbuilder / gist:522c3c79a54cd1c90f7c
Created June 21, 2014 04:41
MODX Performance .htaccess
A few blocks of .htaccess code to help improve your websites performance and/or functionality. I would recommend reading about each section and applying if required instead of applying everything.
The more code in your .htaccess the more your server needs to process BEFORE the HTML starts being served.
______________________ .htaccess starts after this line _________________________________
## Optional - Allow cross-origin requests. ##
# http://enable-cors.org/ - http://www.w3.org/TR/cors/
# https://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
@pepebe
pepebe / ppbHelpManager.plugin.php
Created April 13, 2014 23:07
Initial BETA of ppbHelpManager Plugin for MODX
<?php
/*
ppbHelpManager Plugin
by [email protected]
Version: 0.0.1e - This is a BETA version. Use it at your own risk!
DESCRIPTION:
* hides descriptions of tvs in collapsibles,
* adds modals windows to some or all of them.
@eikes
eikes / jquery.uncheckable_radio.js
Created March 11, 2014 11:42
jQuery plugin to allow unchecking radio buttons
(function ($) {
$.fn.uncheckableRadio = function () {
return this.each(function () {
var radio = this,
label = $('label[for="' + radio.id + '"]');
if (label.length === 0) {
label = $(radio).closest("label");
}
var label_radio = label.add(radio);
label_radio.mousedown(function () {