Skip to content

Instantly share code, notes, and snippets.

@ih2502mk
ih2502mk / list.md
Last active May 14, 2024 18:03
Quantopian Lectures Saved
@ih2502mk
ih2502mk / Angular - custom structural directives.md
Created September 15, 2021 18:44 — forked from JanMalch/Angular - custom structural directives.md
Writing your own structural directives with context variables

Writing your own structural directives with context variables

Complete code in math.directive.ts

After reading this you will be able to create a structural directive with inputs and context variables and use it like this:

<div *math="10; exponent: 3; let input; 
            let exponent = exponent; let r = root;
 let p = power; let ctrl = controller"&gt;
0x1d889fCCB79F8902700Eb313C2255D937F21DC77
@ih2502mk
ih2502mk / gist:8284176
Created January 6, 2014 15:12
Javascript prototypal inheritance.
var __extends = function (child, parent) {
for (var p in parent) {
if (Object.prototype.hasOwnProperty.call(parent, p)) {
child[p] = parent[p];
}
}
function __() {
this.constructor = child;
}
@ih2502mk
ih2502mk / url_key_value
Created November 20, 2012 15:35
adding key_value params to url
var key_value = [
"paam_1=value_1",
"paam_2=value_2",
"paam_3=value_3",
"paam_4=value_4",
]
url.indexOf("?") == -1 ? "?" : "&") + key_value.join("&");
@ih2502mk
ih2502mk / .bashrc
Created November 5, 2012 16:08
current git br in command line
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
BLUE="\[\033[0;36m\]"
DARK_BLUE="\[\033[1;34m\]"
RED="\[\033[0;31m\]"
DARK_RED="\[\033[1;31m\]"
YELLOW="\[\033[0;33m\]"
@ih2502mk
ih2502mk / index.js
Last active August 29, 2015 14:16
requirebin sketch
var uuid = require("uuid")
var rnd_str = require('random-string')
var m = require('mercury');
var h = m.h;
var diff = m.diff;
var patch = m.patch;
var createElement = m.create;
var array = m.array;
@ih2502mk
ih2502mk / post-receive.sh
Last active August 29, 2015 14:15
post-receive hook
#!/bin/bash
now=`date +"%F_%I-%M-%S"`
project=`pwd | awk '{n=split($0,a,"/"); split(a[n],b,"."); print b[1]}'` # Don't ask...
sandbox=$HOME/tmp/$project
if [ ! -d "$sandbox" ]; then
mkdir -p $sandbox
fi
@ih2502mk
ih2502mk / index.js
Created February 16, 2015 02:26
requirebin sketch
var mercury = require("mercury")
var h = mercury.h
var nextTick = require('next-tick')
var rnd_str = require('random-string')
var events = {
addItem: mercury.input()
};
var state = mercury.struct({
@ih2502mk
ih2502mk / index.js
Last active August 29, 2015 14:15
requirebin sketch
var mercury = require("mercury")
var h = mercury.h
var nextTick = require('next-tick')
var rnd_str = require('random-string')
var events = {
addItem: mercury.input(),
removeItem: mercury.input()
};