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
<template lang="pug"> | |
div#app | |
b-jumbotron.h100(header="학생증" lead="바코드 생성기" style="margin-bottom: 0") | |
b-input-group(@keyup.enter="closeKeyboard") | |
b-form-input(v-model="num" type="number" placeholder="학번을 입력해주세요.") | |
b-card | |
barcode(v-if="barcode" :value="barcode" :options="{ displayValue: false, height: '150px' }") | |
div.h150(v-else) | |
div.va 바코드 자리 | |
b-alert(variant="warning" :show="warning") 학번은 9자리입니다. |
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
// - cluster 모듈 사용하기 | |
const cluster = require('cluster') | |
if (cluster.isMaster) { | |
cluster.fork() | |
cluster.fork() | |
cluster.fork() | |
cluster.fork() | |
} else { |
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
const mongoose = require('mongoose') | |
const { promisify } = require('util') | |
const redis = require('redis') | |
const redisUrl = 'redis://127.0.0.1:6379' | |
const client = redis.createClient(redisUrl) | |
client.hget = promisify(client.hget) | |
const exec = mongoose.Query.prototype.exec | |
// this 때문에 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
const puppeteer = require('puppeteer') | |
// 유저 id와 쿠키 key로 만든 세션 버퍼 스트링을 리턴하는 함수 | |
const sessionFactory = require('../factories/sessionFactory') | |
// 테스트용 유저 생성 | |
const userFactory = require('../factories/userFactory') | |
class CustomPage { | |
// Puppteer 브라우저, 페이지 객체를 커스텀 객체와 같이 사용하게 해주는 프록시 반환 | |
static async build () { | |
const browser = await puppeteer.launch({ headless: false }) |
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
const Page = require('./helpers/page') | |
// 각 테스트마다 사용할 페이지 객체 | |
let page | |
// 각 테스트 케이스전에 실행할 코드 | |
beforeEach(async () => { | |
// Custome Helper 클래스의 정적 메서드로 Helper 페이지 인스턴스 생성 (사실 프록시) | |
page = await Page.build() | |
await page.goto('localhost:3000') | |
}) |
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
language: node_js | |
node_js: | |
- "8" | |
dist: trusty | |
services: | |
- mongodb | |
- redis-server | |
env: | |
- NODE_ENV=ci PORT=3000 | |
cache: |
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
const fs = require('mz/fs') | |
const _ = require('partial-js') | |
const trim = s => s.trim() | |
const verbPath = verb => `content/${verb[0]}/${verb}.json` | |
const getJson = _.pipe(fs.readFile, JSON.parse) | |
const remove2ndPerson = _.reject(c => ![0, 2, 3, 4].includes(c.group_sort) && c.sort == 1 || c.sort == 4) | |
const getConj = _.pipe(trim, verbPath, getJson, v => v.conjugations, remove2ndPerson, _.groupBy('group')) |
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
const _ = require('partial-js') | |
const fs = require('mz/fs') | |
const alphabets = 'qwertuiopasdfghjklzxcvbnm' | |
const listVerbs = __(c => `./content/${c}`, fs.readdir) | |
const removeDSStore = _.filter(v => v !== '.DS_Store') | |
const readVerbs = _.map(__(v => `./content/${v[0]}/${v}`, fs.readFile, JSON.parse, c => c.conjugations && c.conjugations.map(cj => (cj.root = c.word, cj)))) | |
const saveJson = category => __(JSON.stringify, _(fs.writeFile, `./${category}.json`, _)) | |
_.filterObject = pred => obj => | |
Object.entries(obj).reduce((acc, [key, val], idx) => |
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
class Graph { | |
constructor () { | |
this.vertices = [] // 노드 | |
this.edges = {} // 연결 | |
} | |
get size () { return this.vertices.length } | |
get relations () { | |
return Object.values(this.edges).reduce((acc, edge) => acc + edge.length, 0) / 2 |
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
const graph = new Graph() | |
graph.addVertex(1, 2, 3, 4, 5, 6) | |
console.log('Added Verteces') | |
graph.print() // 1 -> | 2 -> | 3 -> | 4 -> | 5 -> | 6 -> | |
graph.addEdge(1, 2) | |
graph.addEdge(1, 5) | |
graph.addEdge(2, 3) | |
graph.addEdge(2, 5) | |
graph.addEdge(3, 4) |
OlderNewer