Skip to content

Instantly share code, notes, and snippets.

@Azeirah
Azeirah / gist.js
Last active August 29, 2015 14:05
OnCreateUser doesn't get called
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
Azeirah / gist:e14ca60b891b54639279
Created August 28, 2014 15:06
Failing async tests at creating two accounts
Tinytest.addAsync('test', function (test, done) {
if (Meteor.isClient) {
Accounts.createUser({
username: 'user1',
password: 'fruit'
}, function (err) {
Accounts.logout(function () {
Accounts.createUser({
username: 'user2',
password: 'fruit'
@Azeirah
Azeirah / performance.md
Created July 10, 2014 05:13
JavaScript performance crap
var a = "bla";
for (var i = 0; i < 500000; i++) {
  a += "bla";
}

Is a little faster than

<!DOCTYPE html>
<html>
<head>
<title>Text Editor</title>
<style>
body, document, html {
width: 100%;height: 100%;
}
div {
height: 60rem;
function init () {
instr(parseInt('0000110000', 2));
instr(parseInt('0000110000', 2));
instr(parseInt('0000110000', 2));
instr(parseInt('0000111000', 2));
instr(parseInt('0000001000', 2));
instr(parseInt('0000000001', 2));
instr(parseInt('0000000100', 2));
instr(parseInt('0000001111', 2));
}
@Azeirah
Azeirah / Web toolbelt.md
Last active August 29, 2015 14:01
Javascript simple utilities script that I use often.

A simple web toolbelt

Over time, I commonly see myself using certain functions over and over again, I rewrite them for a lot of applications I create. So instead of having to rewrite them every time, I collect them in this gist.

JavaScript utility Functions

toType

@Azeirah
Azeirah / Default (Linux).sublime-keymap
Last active December 17, 2017 18:50
The settings for my sublime text set-up
[
// Use paste and indent as default paste mechanism,
// this conserves your indentation and it's overall better.
// original paste is now ctrl+shift+v
{
"keys": ["ctrl+v"],
"command": "paste_and_indent"
}, {
"keys": ["ctrl+shift+v"],
"command": "paste"
from Xlib.display import Display
from Xlib import X
from Xlib.ext import record
from Xlib.protocol import rq
import time
disp = None
keysym_map = {
32: "SPACE",
@Azeirah
Azeirah / jQuery toggler
Last active August 29, 2015 13:56
jQuery toggler plugin.
(function ($) {
$.fn.toggler = function () {
var prefix = "data-az",
toggle_groups = $(document).find("[" + prefix + "-toggle-group]"),
togglable_groups = $(document).find("[" + prefix + "-togglable-group]"),
togglables = togglable_groups.find("[" + prefix + "-togglable]"),
toggles = toggle_groups.find("[" + prefix + "-toggle]");
togglables.hide();
@Azeirah
Azeirah / groovemarklet.js
Created December 24, 2013 01:27
JavaScript: groovemarklet
(function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader=