Skip to content

Instantly share code, notes, and snippets.

View andjc's full-sized avatar

Andj andjc

  • Melbourne, Australia
View GitHub Profile

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@andjc
andjc / es6-unicode-shims.js
Last active August 29, 2015 14:26 — forked from slevithan/es6-unicode-shims.js
ES6 Unicode Shims for ES3+
/*!
* ES6 Unicode Shims 0.1
* (c) 2012 Steven Levithan <http://slevithan.com/>
* MIT License
*/
/**
* Returns a string created using the specified sequence of Unicode code points. Accepts integers
* between 0 and 0x10FFFF. Code points above 0xFFFF are converted to surrogate pairs. If a provided
* integer is in the surrogate range, it produces an unpaired surrogate. Comes from accepted ES6
@andjc
andjc / jquery-fallback
Created November 21, 2013 00:22
Fallback for CDN hosted jQuery
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="path/to/your/jquery"><\/script>')</script>
@andjc
andjc / mymr-letter-spacing.css
Last active December 31, 2015 11:19
Letter spacing with old style Myanmar Unicode fonts
h1 {
font-family: TharLon;
letter-spacing: 1px;
-moz-font-feature-settings: 'clig', 'liga';
font-weight: normal;
}
@andjc
andjc / setup-modernie-vagrant-boxes.md
Created February 11, 2016 09:06 — forked from andrealbinop/setup-modernie-vagrant-boxes.md
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

# -*- mode: ruby -*-
# vi: set ft=ruby :
=begin
ModernIE VMs
config.vm.box = "modernIE/vista-ie7"
config.vm.box = "modernIE/w7-ie8"
config.vm.box = "modernIE/w7-ie9"
config.vm.box = "modernIE/w7-ie10"
@andjc
andjc / waitForKeyElements.js
Created July 15, 2016 09:24 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@andjc
andjc / Unicode.md
Created September 27, 2017 12:05 — forked from gornostal/Unicode.md
Python 2.7. Unicode Errors Simply Explained

Python 2.7. Unicode Errors Simply Explained

I know I'm late with this article for about 5 years or so, but people are still using Python 2.x, so this subject is relevant I think.

Some facts first:

  • Unicode is an international encoding standard for use with different languages and scripts
  • In python-2.x, there are two types that deal with text.
    1. str is an 8-bit string.
  1. unicode is for strings of unicode code points.
@andjc
andjc / mm2en.js
Created March 12, 2018 06:29 — forked from eimg/mm2en.js
Convert Myanmar numbers to English numbers
// INPUT: ၁၁.၁၂.၂၀၁၇
// OUTPUT: 11.12.2017
function mm2en(num) {
var nums = { '၀': '0', '၁': 1, '၂': 2, '၃': 3, '၄': 4 , '၅': 5, '၆': 6, '၇':7, '၈':8, '၉':9 };
return num.replace(/([၀-၉])/g, function(s, key) {
return nums[key] || s;
});
}
@andjc
andjc / japanese-font-family.md
Created December 1, 2019 00:22 — forked from prantlf/japanese-font-family.md
Japanese default css font family

Most Japanese websites use default font sets provided on Windows, Mac or Ubuntu. The latest ones are Meiryo, Hiragino Kaku Gothic Pro and Noto. For older versions such like Windows XP, it is good to add former default fonts MS Gothic(or MS Mincho)/Osaka. Older Linux versions may include Takao fonts.

Some old browsers could not understand those font names in English, some others do not recognize the names in Japanese, so it is safe to write both in Japanese and English.

Meiryo and Hiragino's order is, because Mac users may have Meiryo from MS-Office, and Hiragino is more familiar and matching well on Mac, better by starting Hiragino series.

So the current recommended practice is like this:

font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, メイリオ, Meiryo, "MS Pゴシック", "MS PGothic", "MS ゴシック" , "MS Gothic", "Noto Sans CJK JP", TakaoPGothic, sans-serif;