Skip to content

Instantly share code, notes, and snippets.

View Azeirah's full-sized avatar

Laura Azeirah

  • Independent software engineer
  • Netherlands
View GitHub Profile
@Azeirah
Azeirah / g.js
Created August 30, 2014 14:47
adding to profile
Template.register.events({
'submit #register-form': function(event, t) {
event.preventDefault();
var email = t.find('#register-email').value.toLowerCase();
var password = t.find('#register-password').value;
var username = t.find('#register-username').value;
Accounts.createUser({
email: email,
password: password,
username: username,
@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();