Skip to content

Instantly share code, notes, and snippets.

@clonn
clonn / steps-1.md
Created October 6, 2015 09:00
create koding server

steps

term

cd Web/
touch server.js

server.js

@clonn
clonn / index.js
Created October 27, 2015 08:48
express.js route index.js route config
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
var users = {
@clonn
clonn / node_install.sh
Last active May 12, 2016 01:24
node.js v4.2.2 install on Koding.com
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install v4.2.2
nvm alias default v4.2.2
nvm use default
# install other service
npm install -g sails
npm install -g gulp
@clonn
clonn / twilio_sms_sender.js
Created March 17, 2016 11:29
twilio sms sender node.js simple code.
// Your accountSid and authToken from twilio.com/user/account
var accountSid = 'AUTH_SID';
var authToken = "AUTH_KEY";
var client = require('twilio')(accountSid, authToken);
var text = "TEXT_CONTENT";
var users = [--phone number array-];
for (var i=0;i<users.length ; i ++) {
var sender = "+886" + users[i];
@clonn
clonn / preinstall_ubuntu.sh
Last active June 9, 2023 15:10
preinstall.sh for ubuntu 14.04
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install git -y
sudo apt-get install wget -y
sudo apt-get install curl -y
sudo apt-get install nginx -y
sudo apt-get install gcc -y
sudo apt-get install g++ -y
@clonn
clonn / loop_return.js
Created April 21, 2016 08:54
test for loop and return
var s= 10;
for(var i=0; i<=s; i++) {
console.log('run' + i);
try {
if (i===1) { return console.log('run end');}
} catch(e) {
return e;
}
}
@clonn
clonn / preinstall_mac.sh
Last active January 2, 2022 22:32
install mac environment and script
brew update
brew upgrade
brew install git
brew install wget
brew install curl
brew install nginx
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
. ~/.nvm/nvm.sh
@clonn
clonn / front_end_test_flow.md
Last active July 28, 2016 23:38
e2e 測試環境安裝指令

e2e 安裝環境,

建議使用 Unix 環境進行本次課程, 如果是 Windows 學員,如果在以下環境安裝中遇到任何問題,歡迎直接來信給我 [email protected]

預先安裝

  • node.js v4.4.5
  • npm (安裝完上面的 node.js 會提供 npm 的指令)
@clonn
clonn / sailsjs_cli.md
Last active July 27, 2016 09:41
sails new a project
npm install -g sails
npm install -g grunt-cli
npm install -g bower
sails new demo
cd demo
@clonn
clonn / monitor_restart.sh
Created August 28, 2016 14:55
continue run script and auto restart in one line.
while true; do echo 'run script'; sh ./run.sh; done