Skip to content

Instantly share code, notes, and snippets.

View wuxianliang's full-sized avatar

Xianliang Wu wuxianliang

  • Beijing No.2 Experimental Primary School
View GitHub Profile
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.
;; 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))))
@wuxianliang
wuxianliang / CalendarDay.cql
Created November 8, 2015 14:27 — forked from kbastani/CalendarDay.cql
This gist is a Neo4j Cypher query for merging a calendar graph for a specific year. This query has 4 levels of indexes, consisting of year, month, day, hour.
// 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 })
@wuxianliang
wuxianliang / README.md
Last active August 29, 2015 14:27 — forked from secondstar/README.md
Trulia 24/7 House Hunting

An paring down of trulia's page to get the essence of how it works.

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]
import prelude
Signal = -> new (class SignalClass
(register) ->
@handlers = []
register @send
send: (value) ~>
@_value = value
for handler in @handlers => handler value
$.fn.queue = function(){
var Q = function(){
this.q = [];
}
Q.prototype = {
enqueue: function(el){
if($.isArray(el)){
this.q = el;