Skip to content

Instantly share code, notes, and snippets.

@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;
@ih2502mk
ih2502mk / list.md
Last active April 29, 2024 02:23
Quantopian Lectures Saved
0x1d889fCCB79F8902700Eb313C2255D937F21DC77
@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()
};
@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()
};
@ih2502mk
ih2502mk / js-object-key-value-stored.js
Last active August 29, 2015 14:14
js-key-value-storage-objects
universal_getter = function(id, prop_name, cb) {
// get it from db or some data set
// if fails set erro to `new Error()`
//
// if storage is locked wait till it gets unlocked
//
// goGetItFromDB(prop_name, function(err, val) {
return cb(err, val);
// })
@ih2502mk
ih2502mk / app.js
Last active August 29, 2015 14:08 — forked from zulfajuniadi/app.js
/*
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>VirtualDOM Example</title>
</head>
<body>
<div id="output"></div>