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
undefined is not a function | |
undefined | |
TypeError: undefined is not a function | |
at exports.current_user (/Users/chenlizhan/Desktop/Lee/Programming/node/Web/expresss4/todo/routes/index.js:62:34) | |
at Layer.handle [as handle_request] (/Users/chenlizhan/Desktop/Lee/Programming/node/Web/expresss4/todo/node_modules/express/lib/router/layer.js:82:5) | |
at trim_prefix (/Users/chenlizhan/Desktop/Lee/Programming/node/Web/expresss4/todo/node_modules/express/lib/router/index.js:302:13) | |
at /Users/chenlizhan/Desktop/Lee/Programming/node/Web/expresss4/todo/node_modules/express/lib/router/index.js:270:7 | |
at Function.proto.process_params (/Users/chenlizhan/Desktop/Lee/Programming/node/Web/expresss4/todo/node_modules/express/lib/router/index.js:321:12) |
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
# Author: Lee Chen(chung1350@gmail.com) | |
# XorHelper provides an encode method to xor a file with a key | |
module XorHelper | |
# XOR encodes/decodes a document with a key | |
# Parameters: | |
# doc: string | |
# key: string | |
# Returns: string |
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
$ bundle exec rake compile | |
cd tmp/x86_64-darwin14/nmatrix/2.2.0 | |
/Users/chenlizhan/.rvm/rubies/ruby-head/bin/ruby -I. ../../../../ext/nmatrix/extconf.rb | |
using C++ standard... c++11 | |
g++ reports version... gcc | |
checking for main() in -lclapack... *** ../../../../ext/nmatrix/extconf.rb failed *** | |
Could not create Makefile due to some reason, probably lack of necessary | |
libraries and/or headers. Check the mkmf.log file for more details. You may | |
need configuration options. |
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
# see http://en.wikipedia.org/wiki/Fizz_buzz for details on FizzBuzz game | |
# Naive fizzbuzz method that yields fizzbuzz game results one at a time | |
def fizzbuzz(size) | |
[*1..size].each do |number| | |
number = 'fizzbuzz' if number % 15 == 0 | |
number = 'fizz' if number % 3 == 0 | |
number = 'buzz' if number % 5 == 0 | |
yield number.to_s | |
end |
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
# Our bonus application is available at https://gist.github.com/ChenLiZhan/278863a90703dcc8f87c | |
require 'yaml' | |
def read_tsv(input_file) | |
content, head, informations = [], [], [] | |
File.open(input_file, 'r') do |file| | |
head = file.readline.gsub("\n", '').split("\t") | |
file.each_line do |line| | |
content << line.gsub("\n", '').split("\t") |
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
require 'yaml' | |
def get_head(informations) | |
informations[0].keys.join("\t") | |
end | |
def get_content(informations) | |
info = '' | |
informations.each do |information| | |
info << information.values.join("\t") << "\n" |
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
The methods we can use when testing: | |
METHODS = [ | |
:request, | |
:get, | |
:post, | |
:put, | |
:patch, | |
:delete, | |
:options, | |
:head, |
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
Change the default assets directory (Change to assets from public) | |
- set :public_folder, File.dirname(__FILE) + '/assets' |
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
bundle install | |
- Install the dependencies specified in your Gemfile. | |
bundle exec | |
- This command making all gems specified in Gemfile avaliable to require in Ruby programs. |