Skip to content

Instantly share code, notes, and snippets.

View totuworld's full-sized avatar

totuworld totuworld

View GitHub Profile
@totuworld
totuworld / index.js
Last active August 29, 2015 14:26
express + sequelize
"use strict";
var fs = require("fs");
var path = require("path");
var Sequelize = require("sequelize");
var env = process.env.NODE_ENV || "development";
var config = require(__dirname + '/../config/config.json')[env];
var sequelize = new Sequelize(config.database, config.username, config.password, config);
var db = {};
@totuworld
totuworld / users.js
Last active August 29, 2015 14:26
사용자 정보를 등록한다.
/* POST 사용자 아이디를 등록할 때 사용한다. */
router.post('/add/:userID', function(req, res) {
//아이디 중복 확인
function CheckIsHaveID(callback) {
models.usercore.find({where:{id:req.params.userID}})
.then(function(findUserCoreData) {
callback( !(findUserCoreData == null || findUserCoreData == undefined) );
});
}
@totuworld
totuworld / config.json
Last active December 16, 2015 04:24
강의용
{
"development": {
"dialect": "mssql",
"host":"{host}.database.windows.net",
"port":1433,
"username": "{your_username}",
"password": "{your_password}",
"dialectOptions":{
"encrypt": true,
"database":"{database}"
const SERVICE_ACCOUNT_KEY_FILE = './key.json';
var tokenStorage = {
access_token: null,
token_type: null,
expiry_date: null
};
//access_token을 확인한다.
function CheckAccessToken() {
return new Promise(function (resolve, reject) {
@totuworld
totuworld / index.js
Last active March 24, 2016 01:22
apple iap validation
const iap = require('in-app-purchase');
iap.config({applePassword:""});
iap.setup(function (err) {
if (err) {
return console.error('something went wrong...');
}
else {
console.log('iap init done');
@totuworld
totuworld / build_prompt
Last active April 8, 2016 05:42
agnoster
## Main prompt
build_prompt() {
RETVAL=$?
prompt_status
prompt_virtualenv
prompt_context
prompt_dir
prompt_git
prompt_hg
prompt_newline
@totuworld
totuworld / index.js
Last active April 14, 2016 06:55
slackwiki
'use strict';
const querystring = require('querystring');
module.exports = function(context, req) {
let parseBody = querystring.parse(req.body);
if (parseBody.text) {
context.res = {
"content-type":"application/json",
@totuworld
totuworld / httpRequestTest.js
Created April 25, 2016 22:16
Node.js HttpRequest
'use strict';
const http = require('http');
let url = (process.env.targetURL)?process.env.targetURL:'google.com';
const options = {
hostname: url
};
@totuworld
totuworld / addgitremote
Last active May 30, 2016 08:23
Azure웹앱배포
git init
git remote add azure [웹앱 git 주소]
git commit -m "init"
git push azure master
GET / 200 1.863 ms - 191
GET / 200 2.008 ms - 191