Skip to content

Instantly share code, notes, and snippets.

View uyu423's full-sized avatar

Yongwoo Yu (Yowu) uyu423

View GitHub Profile
class Money {
constructor(value) {
if (value < 0) throw Error('Money Type Valiation Exception');
this.value = value;
}
}
class Email {
constructor(email) {
const regExp = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
class A {
constructor(value) {
this.value = value
}
adder() {
this.value += 1;
}
}
const v = new A(10);
@uyu423
uyu423 / simple404page.html
Created March 6, 2017 16:20
갑자기 필요해서 대충 만든 404 Not Found 페이지
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Oops !!</title>
<!-- Fonts -->
@uyu423
uyu423 / webpack.config.js
Created March 6, 2017 03:10
simple and default webpack config js (2017.03.06, webpack 2.2.1)
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'public/'),
filename: 'bundle.js',
},
@uyu423
uyu423 / csv2sql.js
Created March 3, 2017 03:19
csv 파일을 파싱해서 SQL 문으로 만들어보자
const csv = require('csvtojson');
const moment = require('moment');
const path = './update_needed_usersv4.csv';
// csv file sample (./update_needed_usersv4.csv)
/*
idx,created_at
130,2015-10-07 8:22
131,2015-10-07 8:23
132,2015-10-07 8:24
@uyu423
uyu423 / changeMacAddress.sh
Created January 28, 2017 10:47
How To Change Mac Adress on Linux
#!/bin/sh
# sudo ifconfig [adapter] hw ether [MAC Addr]
sudo ifconfig wlp58s0 down
sleep 1
sudo ifconfig wlp58s0 hw ether AA:BB:CC:DD:EE:FF
sudo ifconfig wlp58s0 up
import tensorflow as tf
import numpy as np
x_data = np.float32(np.random.rand(2, 100))
y_data = np.dot([0.100, 0.200], x_data) + 0.300
b = tf.Variable(tf.zeros([1]))
W = tf.Variable(tf.random_uniform([1, 2], -1.0, 1.0))
y = tf.matmul(W, x_data) + b
import tensorflow as tf
state = tf.Variable(0, name="counter")
one = tf.constant(1)
new_value = tf.add(state, one)
update = tf.assign(state, new_value)
init_op = tf.global_variables_initializer()
@uyu423
uyu423 / cognitoAndFacebookLogin.html
Created December 15, 2016 17:49
AWS Cognito 서비스와 Facebook SDK Login 기능 연동
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/aws-sdk/2.7.14/aws-sdk.min.js"></script>
</head>
<body>
<script>
// This is called with the results from from FB.getLoginStatus().
@uyu423
uyu423 / naverN2MTBot.js
Created November 10, 2016 08:26
네이버 NMT API를 사용한 텔레그램 번역 봇 서비스 (Node.js)
/* Corder By Yowu ([email protected]). 20161029 */
import TelegramBot from 'node-telegram-bot-api';
import { localMysqlexecutor as mysql } from '../../configs/mysql.js';
import { TEST_BOT, DEVELOPER_BOT } from '../../configs/tokens.js';
import moment from 'moment';
import fetch from 'node-fetch';
import urlEncoder from 'form-urlencoded';
const TOKEN = process.env.NODE_ENV == 'production' ? DEVELOPER_BOT : TEST_BOT;