- install nvm:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
nvm install 7.0.0
nvm use 7.0.0
# or you can download and install https://npm.taobao.org/mirrors/node/latest-v7.x/node-v7.0.0.pkgnpm install --registry=https://registry.npm.taobao.org
- nvm use 7.0.0
- export PATH=node_modules/.bin:$PATH
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
re:replace(<<"foo require('test.js') bar;\n require('test2.js');">>, "(require\\((.*)\\);?)", "<<\\g1>>--<<\\g2>>", [global, {return, list}]). | |
"foo <<require('test.js')>>--<<'test.js'>> bar;\n <<require('test2.js')>>--<<'test2.js'>>" | |
% "foo <<require('test.js')>>--<<'test.js'>> bar;\n <<require('test2.js')>>--<<'test2.js'>>" |
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
var formInputValue = '[email protected]'; | |
var model = {}; | |
Object.defineProperty(model, 'email', { | |
get: function () { | |
return formInputValue; | |
}, | |
set: function (value) { | |
console.log(value); | |
formInputValue = 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
######### for tensorflow and cuda ############################################################## | |
# sudo cp /usr/local/cuda/lib/libcuda.dylib /usr/local/cuda/lib/libcuda.1.dylib | |
export CUDA_HOME=/usr/local/cuda | |
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$CUDA_HOME/lib" | |
export PATH="$CUDA_HOME/bin:$PATH" | |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib/" |
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
# -*- coding: utf-8 -*- | |
""" | |
jinja2.loaders | |
~~~~~~~~~~~~~~ | |
Jinja loader classes. | |
:copyright: (c) 2010 by the Jinja Team. | |
:license: BSD, see LICENSE for more details. | |
""" |
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
// load jschardet js lib | |
// $.getScript('https://cdnjs.cloudflare.com/ajax/libs/jschardet/1.4.1/jschardet.min.js') | |
var xhr = new XMLHttpRequest(), blob; | |
xhr.open("GET", "http://127.0.0.1:5000/api/uploads/404/blob", true); | |
// Set the responseType to blob | |
xhr.responseType = "blob"; | |
xhr.addEventListener("load", function() { |
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
<html> | |
<head> | |
<title>test css</title> | |
<meta charset="utf-8"/> | |
<style> | |
.line { | |
overflow: hidden; | |
width: 50%; | |
} |
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 sass-convert -i --indent 4 -F scss -T scss -R /Users/dyw/code/wg/lms/assets/scss/ /Users/dyw/code/wg/lms/assets/scss/` |
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
var fs = require('fs'); | |
function require2(url){ | |
var source = fs.readFileSync(url,'utf-8'); | |
var code = new Function('exports, module', source); | |
var exports = {}; | |
var module = { | |
exports: exports | |
}; | |
code(exports, module); |
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
function findSolution(target){ | |
function find(start, history){ | |
if(start > target){ | |
return null; | |
} | |
if(start === target){ | |
return history; | |
} | |
return find( start * 3, '(' + history + ') * 3' ) || find( start + 5, '(' + history + ') + 5' ); | |
} |