Skip to content

Instantly share code, notes, and snippets.

@zalavariandris
zalavariandris / GA.hpp
Last active June 26, 2018 14:34
A genetic algorithm with c++
#pragma once
#include <array>
#include <random>
#include <limits>
#include <iostream>
#include <algorithm>
namespace GA{
@zalavariandris
zalavariandris / EditView.coffee
Last active August 29, 2015 13:56
two way binding with contenteditable in Meteor (concept)
if Meteor.isClient
Template.EditText = UI.Component.extend
kind: "Edit"
init: ()->
self = this
self.textDep = new Deps.Dependency
self.getText = ()->
self.textDep.depend()
self.text
if Meteor.isServer
Meteor.publish "collection", (limit)->
return collection.find({}, {limit: limit})
if Meteor.isClient
length = 0
Deps.autorun ()->
count = collection.find({}).count()
if length <= count then length++ else length = count