Skip to content

Instantly share code, notes, and snippets.

Laura Azeirah

Block or report user

Report or block Azeirah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Azeirah / listLocales.php
Created Dec 26, 2016
List supported locales
View listLocales.php
// this list is large, but might not be completely exhaustive.
// I retrieved it from this stackoverflow answer:
// and added zh_TW
$locales = ["af_NA", "af_ZA", "af", "ak_GH", "ak", "sq_AL", "sq", "am_ET", "am", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SD", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "ar", "hy_AM", "hy", "as_IN", "as", "asa_TZ", "asa", "az_Cyrl", "az_Cyrl_AZ", "az_Latn", "az_Latn_AZ", "az", "bm_ML", "bm", "eu_ES", "eu", "be_BY", "be", "bem_ZM", "bem", "bez_TZ", "bez", "bn_BD", "bn_IN", "bn", "bs_BA", "bs", "bg_BG", "bg", "my_MM", "my", "ca_ES", "ca", "tzm_Latn", "tzm_Latn_MA", "tzm", "chr_US", "chr", "cgg_UG", "cgg", "zh_Hans", "zh_Hans_CN", "zh_Hans_HK", "zh_Hans_MO", "zh_Hans_SG", "zh_Hant", "zh_Hant_HK", "zh_Hant_MO", "zh_Hant_TW", "zh", "kw_GB", "kw", "hr_HR", "hr", "cs_CZ", "cs", "da_DK", "da", "nl_BE", "nl_NL", "nl", "ebu_KE", "ebu", "en_AS", "en_AU", "en_BE", "en_BZ", "en_
Azeirah /
Created Oct 16, 2016
Confy, dictionary backed by a json file, use it for your configuration files.
"""Confy, a dictionary backed by a json file, serves as a replacement to ini/config files. Use like any other dict, call .save() to save.
Initialize it with a filename, the backing file will be created if it didn't previously exist,
otherwise, the contents of the file will be loaded into the dict.
save using, loading happens automatically
import json
import collections
View loggy.js
function rateLimit(fn, rate) {
var queue = [];
var currentlyEmptyingQueue = false;
function emptyQueue() {
if (queue.length) {
currentlyEmptyingQueue = true;
window.setTimeout(function () {
View createNonIntersectingPolygon.js
* Calculates if a given point `point` lies above a given line `p1p2`
* THIS FUNCTION DOES NOT RETURN BOOLEANS. It has three different return values, above = 1, below = -1, on the line = 0.
* @param {[x, y]} point The point to test for
* @param {[x, y]} p1 The starting point of a line
* @param {[x, y]} p2 The ending point of a line
* @return {number} 1 = above, -1 = below, 0 = exactly on the line
function pointAboveLine(point, p1, p2) {
// first, horizontally sort the points in the line
Azeirah /
Created Mar 25, 2016
Sublime Text - Automatic reindentation while swapping

Sublime Text has a somewhat hidden feature to automatically reindent the current line. It would be wasteful to bind this to a keybinding, I prefer it to be automatic.

print("Executing a function")
def someFunction():
    return 5

Moving the print line one line down with ctrl+shift+down will result in


Keybase proof

I hereby claim:

  • I am azeirah on github.
  • I am azeirah ( on keybase.
  • I have a public key whose fingerprint is C6CC 3CFF 9C23 0D36 124F 26C2 B4D2 59A9 2CA3 1AE3

To claim this, I am signing this object:

View meteorhelper.js
Template.previewNote.rerender = function () {
var codes = UI._templateInstance().findAll("pre>code");
for (var i = 0; i < codes.length; i++) {
Azeirah / g.js
Created Aug 30, 2014
adding to profile
View g.js{
'submit #register-form': function(event, t) {
var email = t.find('#register-email').value.toLowerCase();
var password = t.find('#register-password').value;
var username = t.find('#register-username').value;
email: email,
password: password,
username: username,
Azeirah / gist.js
Last active Aug 29, 2015
OnCreateUser doesn't get called
View gist.js
if (Meteor.isServer) {
var _onCreateUser = Accounts.onCreateUser.bind(Accounts);
// Since onCreateUser overrides default behavior, and we don't want to restrict package users
// by removing the onCreateUser function, we override onCreateUser to modify the user document before the regular onCreateUser call.
Accounts.onCreateUser = function (func) {
console.log('oncreatinguser outer');
_onCreateUser(function (options, user) {
console.log('oncreateuser inner');
if (!user.profile) {
user.profile = options.profile || {};
Azeirah / gist:e14ca60b891b54639279
Created Aug 28, 2014
Failing async tests at creating two accounts
View gist:e14ca60b891b54639279
Tinytest.addAsync('test', function (test, done) {
if (Meteor.isClient) {
username: 'user1',
password: 'fruit'
}, function (err) {
Accounts.logout(function () {
username: 'user2',
password: 'fruit'
You can’t perform that action at this time.