Skip to content

Instantly share code, notes, and snippets.

@dobriai
dobriai / immediate.js
Last active October 5, 2017 03:19
Promise timing
if (false) {
new Promise((resCB) => {
console.log('First Promise');
resCB('p1');
}).then(res => {
console.log(`res = ${res}`);
})
} else {
(async () => {
let res = await new Promise((resCB) => {
@dobriai
dobriai / Promise.js
Last active June 8, 2018 01:47
JS Promises - trivial impl.
function Promise(fn) {
var state = 'pending';
var value;
var deferred = null;
function resolve(newValue) {
if(newValue && typeof newValue.then === 'function') {
newValue.then(resolve);
return;
}
@dobriai
dobriai / dynamo_revit_snip.py
Last active May 3, 2017 22:17
Dynamo Revit Python Snippets
# Universal header
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
from Revit.Elements import *
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *