An paring down of trulia's page to get the essence of how it works.
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
import types | |
import tensorflow as tf | |
import numpy as np | |
# Expressions are represented as lists of lists, | |
# in lisp style -- the symbol name is the head (first element) | |
# of the list, and the arguments follow. | |
# add an expression to an expression list, recursively if necessary. | |
def add_expr_to_list(exprlist, expr): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
;; Adapted from https://github.com/ReactiveX/RxPY/blob/master/examples/konamicode/konamicode.py | |
(import [rx.subjects [Subject]]) | |
(setv codes [:up :up :down :down :left :right :left :right :b :a]) | |
(setv subject (Subject)) | |
(setv query (-> (.window_with_count subject 10 1) | |
(.select-many (fn [win] (.sequence-equal win codes))) | |
(.filter (fn [equal] equal)))) |
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
// Enter the day you would like to create | |
WITH { day: 18, month: 1, year: 2014 } as dayMap | |
// Merge hours in a day | |
MERGE (thisDay:Day { day: dayMap.day, month: dayMap.month, year: dayMap.year }) | |
MERGE (firstHour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: 1 }) | |
CREATE (thisDay)-[:FIRST]->(firstHour) | |
FOREACH (i IN tail(range(1, 24)) | | |
MERGE (thishour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i }) | |
MERGE (lasthour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i - 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
import mongoengine | |
class MongoModelSerializer(serializers.ModelSerializer): | |
def get_default_fields(self): | |
cls = self.opts.model | |
opts = get_concrete_model(cls) | |
#pk_field = opts.pk | |
fields = [] | |
fields += [getattr(opts, field) for field in opts._fields] | |
#fields += [field for field in opts.many_to_many if field.serialize] |
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
import prelude | |
Signal = -> new (class SignalClass | |
(register) -> | |
@handlers = [] | |
register @send | |
send: (value) ~> | |
@_value = value | |
for handler in @handlers => handler value |
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
$.fn.queue = function(){ | |
var Q = function(){ | |
this.q = []; | |
} | |
Q.prototype = { | |
enqueue: function(el){ | |
if($.isArray(el)){ | |
this.q = el; |