This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns we | |
(:require clojure.contrib.json.read) | |
(:require clojure.contrib.json.write) | |
(:require clojure.set) | |
(:use clojure.contrib.json.read) | |
(:use clojure.contrib.json.write) | |
(:use clojure.set) | |
(:use compojure)) | |
; db is a map between replocs and blipData (= the event json we get from wave) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn-log match-rep-loc | |
"in this context rep-op is the incoming rep-op, rep-loc is what is for comparison from the rep-class from rep-rules" | |
[rep-op rep-class] | |
(for [rep-loc rep-class | |
:when | |
(cond | |
(and (:blip-id rep-loc) | |
(= (:rep-loc rep-op) rep-loc)) | |
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 0; | |
var len = object.length; | |
objects.forEach(function() { | |
if (something) { | |
doSomethingAsync(function(data) { | |
doSomethingWithData(data); | |
if (i === len - 1) { | |
returnResponseToClient(); | |
} | |
i++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autologin = function(){ | |
var state = Meteor.uuid(); | |
$.get('/_oauth/facebook?close&state=' + state + | |
'&access_token=' + | |
FB.getAccessToken(), function() { | |
Meteor.call('login', {oauth: {state: state}}, function(e, result) { | |
Accounts._makeClientLoggedIn(result.id, result.token); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:void( | |
function(){ | |
document.head.innerHTML = ''; | |
var jsCode=document.createElement('script'); | |
jsCode.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'); | |
document.body.appendChild(jsCode); | |
setTimeout(()=>{ | |
var art = $('.article'); | |
if (art.length === 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//var prefs = [[2,3],[1,3],[1,2],[5,6],[4,6],[4,5],[8,9],[7,9],[7,8],[11,12],[10,12],[10,11],[14,15],[13,15],[13,14],[17,18],[16,18],[16,17]]; | |
var perfstr = `1 13 16 | |
2 13 18 | |
3 7 10 | |
4 11 16 | |
5 6 9 | |
6 13 5 | |
7 5 6 | |
8 -1 -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var amount = 1000; | |
var billDays = 1000 ; | |
var yesGuestDays = 1000; | |
/// | |
var noGuestDays = billDays - yesGuestDays; | |
var amountPerDay = amount / billDays; | |
var orenPay = (amountPerDay / 2) * noGuestDays + (amountPerDay / 3) * yesGuestDays; | |
var ayalPay = amount - orenPay; | |
console.log(`Oren: ${orenPay.toFixed(0)}, (${((orenPay / amount)*100).toFixed(0)}%) | |
Ayal: ${ayalPay.toFixed(0)}, (${((ayalPay / amount)*100).toFixed(0)}%)`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var userSums = [{name: 'ayal', sum: 400}, {name: 'tomer', sum: 300}, {name: 'guy', sum: 250}, {name: 'ronni', sum: 0}, {name: 'max', sum: 0}]; | |
var sum = userSums.reduce((acc,u)=>acc+u.sum,0); | |
var usum = sum / userSums.length; | |
userSums.map(x=>(x.balance = x.sum - usum) && (x.gotgave = 0)); | |
var balanceUsers = (u1,u2)=> { | |
if (u1.balance < 0 && u2.balance > 0) { | |
// u1 pays u2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cp = require("child_process"); | |
console.log('hi from child', process.stdin.isRaw) | |
setInterval(() => { | |
console.log('hi from child', process.stdin.isRaw); | |
}, 1000); | |
var child2 = cp.fork('child2.js', []); | |
console.log('child 2 pid', child2.pid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{\"0⃣\":[\"0\",\"keycap\",\"number\",\"zero\"],\"1⃣\":[\"1\",\"number\",\"one\"],\"🕐\":[\"1\",\"00\",\"1:00\",\"clock\",\"one\",\"one o’clock\",\"o’clock\",\"time\"],\"🕜\":[\"1\",\"30\",\"1:30\",\"clock\",\"one\",\"one-thirty\",\"thirty\",\"time\"],\"🕑\":[\"2\",\"00\",\"2:00\",\"clock\",\"o’clock\",\"time\",\"two\",\"two o’clock\"],\"2⃣\":[\"2\",\"number\",\"two\"],\"🕝\":[\"2\",\"30\",\"2:30\",\"clock\",\"thirty\",\"time\",\"two\",\"two-thirty\"],\"🕒\":[\"3\",\"00\",\"3:00\",\"clock\",\"o’clock\",\"three\",\"three o’clock\",\"time\"],\"🕞\":[\"3\",\"30\",\"3:30\",\"clock\",\"thirty\",\"three\",\"three-thirty\",\"time\"],\"3⃣\":[\"3\",\"keycap\",\"number\",\"three\"],\"🕓\":[\"4\",\"00\",\"4:00\",\"clock\",\"four\",\"four o’clock\",\"o’clock\",\"time\"],\"🍀\":[\"4\",\"clover\",\"four\",\"four leaf clover\",\"irish\",\"leaf\",\"lucky\",\"plant\"],\"🕟\":[\"4\",\"30\",\"4:30\",\"clock\",\"four\",\"four-thirty\",\"thirty\",\"time\"],\"4⃣\":[\"4\",\"four\",\"number\"],\"🕠\":[\"5\",\"30\",\"5:30\",\"clock\",\"five\",\ |
OlderNewer