Skip to content

Instantly share code, notes, and snippets.

View skrat's full-sized avatar

Dušan Maliarik skrat

View GitHub Profile
var express = require('express');
var Promise = require("bluebird");
var fs = Promise.promisifyAll(require('fs'));
var app = express();
function pipe() {
return [].reduce.call(arguments, function(red, p) {
return red.then(p);
}
}
xs.unshift(0).zip(xs.push(1)).map ([a, b]) -> ...
vs.
(->> (zip (cons 0 xs)
(conj xs 1))
(map (fn [[a, b]] ...)))
def geometry_mat(self, b_obj, b_mat):
bpy.ops.object.material_slot_add()
b_obj.material_slots[0].link = 'OBJECT'
b_obj.material_slots[0].material = b_mat
;; CLJ
(defn browser-repl []
(let [repl-env (weasel/repl-env :ip "0.0.0.0" :port 9001)]
(piggieback/cljs-repl :repl-env repl-env)
(piggieback/cljs-eval {} repl-env '(in-ns 'sketcher.core) {})))
;; CLJS
(weasel/connect "ws://localhost:9001" :verbose true :print #{:repl :console})
;; project.clj
function start(){
// save the context state
ctx.save();
// draw the overlay
ctx.drawImage(overlay,150,35);
// change composite mode to source-in
// any new drawing will only overwrite existing pixels
cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped = (function run_state_machine_wrapped(state){
try{return cljs.core.async.impl.ioc_helpers.run_state_machine.call(null,state);
}catch (e25988){if((e25988 instanceof Object)){
var ex = e25988;
cljs.core.async.impl.protocols.close_BANG_.call(null,cljs.core.async.impl.ioc_helpers.aget_object.call(null,state,cljs.core.async.impl.ioc_helpers.USER_START_IDX));
console.error(ex); // <---
throw ex;
} else {
throw e25988;
$.Pb = function(a, b, c, d) {
return{textures:{}, materials:xf(xg(function(a, b) {
return new ka(null, 2, [Df, Of.b(Qf.b(b)), Lf, 1 - Tf.b(Qf.b(b))], null);
}, Sd.a(Ce, Z.a(Pf, Q.a(qd, bf(a)))))), geometries:xf(Q.a(qd, Z.a(function(a) {
return function g(a) {
return new V(null, function() {
for (;;) {
var b = E(a);
if (b) {
if (R(b)) {
(let [n nil fizz (cycle [n n "fizz"]) buzz (cycle [n n n n "buzz"]) nums (iterate inc 1)]
(take 20 (map #(if (or %1 %2) (str %1 %2) %3) fizz buzz nums)))
a = m.map(e => m.vector.apply(null, e), a_poly.vertices)
b = m.map(e => m.vector.apply(null, e), b_poly.vertices)
m.equals(m.set(a),
m.set(b))
// you could cache the hash, so whenever and area (or polygon) is created/updated
// you would store the hash on it; inside the poly class (or Area)
v = m.map(e => m.vector.apply(null, e), this.vertices)
macro @ {
case { _ $x } => {
letstx $sx = [makeValue(unwrapSyntax(#{$x}), #{here})];
return #{ Symbol.for($sx) }
}
}
function todoApp(state, action) {
if (state === undefined) state = initialState;
switch (action.type) {