Skip to content

Instantly share code, notes, and snippets.

View coodoo's full-sized avatar

Jeremy Lu coodoo

View GitHub Profile
@coodoo
coodoo / LookupTableEx.lua
Created April 4, 2016 08:42
Added support to pass in pre-trained weights for LookupTable so that RNNLM could be trained with large data set
local THNN = require 'nn.THNN'
local LookupTable, parent = torch.class('nn.LookupTable', 'nn.Module')
LookupTable.__version = 4
-- added 3rd argument, to pass in pre-trained weights
function LookupTable:__init(nIndex, nOutput, odlWeights )
parent.__init(self)
-- simple case to reproduce GPU crash bug
require 'paths'
require 'rnn'
require 'nngraph'
require 'cltorch'
require 'clnn'
cltorch.setDevice(1)
------------------------------------------------------------------------------------
@coodoo
coodoo / gist:821a77ac574acfb09a65
Last active October 21, 2015 02:01
Just picking up rx and building this as a practice, wondering what's the most elegant way to implement it?
- demo
- http://cl.ly/image/2s0W0z1X3g2q
- spec
- show tooltip after mouseover the button for 300ms
- if mouseout within 300ms, don't show tooltip
- hide tooltip when mouseout the button
- hide tooltip after 1000ms
@coodoo
coodoo / gist:59891964b06a603e2dc8
Created September 3, 2015 00:16
react isomorphic 原理
- 我想要挑戰isomorphic,但目前好像比較少redux配isomorphic又配上webpack的方案
- 這個範例可看,最近全部改寫過
- https://github.com/coodoo/react-redux-isomorphic-example
- 注意下面幾點
- js/bootClient.js 與 js/bootServer.js
- bootServer.js 負責做 server-render
# 十月技術匯報
- GraphQL/Relay release
- http://facebook.github.io/relay/docs/getting-started.html#content
- Redux v1
- http://rackt.github.io/redux/
- React 0.14 beta3
# Overview
- GraphQL
- 是 query language
- 也是一份規格
- GraphQL engine
- spec 的實作
- 已有多種語言版本的實作(FB 官方提供 js 實作)

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@coodoo
coodoo / foo.js
Last active August 29, 2015 14:21
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'chrome'
},
host: '127.0.0.1',
port: 8888,
waitforTimeout: 10*1000,
coloredLogs: true,
logLevel: 'verbose' // verbose, silent, command, data, result
@coodoo
coodoo / gist:dbbf7d263e972a59e64e
Last active August 29, 2015 14:17
Convert css file to js object and clean up the key a bit to stripe '.' so that it's compatible with react-native
// var convert = require('css-to-radium');
// var fs = require('fs');
// var path = require('path');
// var css = fs.readFileSync( path.resolve('./', 'app.css'), 'utf8');
// var result = convert(css);
// console.log( '\nresult: \n', require('util').inspect( result, false, 2, true) );
// 模擬 css 轉換後的 js 物件,要將 .foo 轉成 foo
var o = {
'.foo': 'barr',