Skip to content

Instantly share code, notes, and snippets.

View CreatiCoding's full-sized avatar
❤️
Maybe busy by something

정석호 CreatiCoding

❤️
Maybe busy by something
View GitHub Profile
const _ = require('lodash');
var obj = [
{ x: 1, x1: 123, a: 2, b: 3 },
{ x: 2, x1: 5432, a: 4, b: 23 },
{ x: 1, x1: 123, a: 123, b: 324 },
];
var common_column = ['x', 'x1'];
var result = _.chain(obj)
.groupBy('x')
@CreatiCoding
CreatiCoding / purewatch.js
Created August 23, 2019 17:43
javascript pure watch
// standard watch
const watch = (obj, key, defalut_value, callback) => {
Object.defineProperty(obj, key, {
get() {
return this._value || defalut_value;
},
set(value) {
this._value = value;
callback(this._current);
},
@CreatiCoding
CreatiCoding / RedisACL.ts
Last active August 29, 2019 20:25
typescript redis api acl manage with promise to async/await
import { RedisClient, createClient } from "redis";
const API = "api";
export class RedisACL {
private client: RedisClient;
constructor(private password: string) {
this.client = createClient({ password });
}
@CreatiCoding
CreatiCoding / List.vue
Last active October 10, 2019 15:37
vue slots scope custom component
<template>
<div>
<div v-for="(content, index) in contents" :key="`key_${identifier}_${index}`">
<slot name="List" :content="content"></slot>
</div>
</div>
</template>
<script>
export default {
@CreatiCoding
CreatiCoding / ubuntu.sh
Last active October 28, 2019 09:49
creco's ubuntu
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common build-essential vim git curl net-tools openssh-server zsh direnv
# zsh
sudo chsh -s /bin/zsh
# git
git config --global user.name "CreatiCoding"
@CreatiCoding
CreatiCoding / dayjs.locale.js
Created October 23, 2019 08:09
dayjs 로케일 설정
dayjs(new Date().toLocaleString("en-US", {timeZone: "Asia/Seoul"})).format('YYYY-MM-DD HH:mm:ss')
@CreatiCoding
CreatiCoding / set-config.sh
Created October 24, 2019 12:45
shell script programming
#!/bin/bash
uname_out="$(uname -s)"
case "${uname_out}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${uname_out}"
esac
@CreatiCoding
CreatiCoding / index.ts
Created April 4, 2020 16:42
Firebase Cloud Functions GraphQL
import { https } from "firebase-functions";
import * as express from "express";
import { ApolloServer, gql } from "apollo-server-express";
const typeDefs = gql`
# Comments in GraphQL strings (such as this one) start with the hash (#) symbol.
# This "Book" type defines the queryable fields for every book in our data source.
type Book {
title: String
@CreatiCoding
CreatiCoding / 100ms_delay.js
Created April 9, 2020 03:25
javascript delay in async area
await (() => new Promise((resolve) => setTimeout(() => resolve(true), 100)))();
@CreatiCoding
CreatiCoding / GIF2MP4.vue
Last active April 10, 2020 01:13
vue component for gif to mp4 convertor with ffmpeg
<template>
<div id="app">
<div>
<input type="file" @change="previewFile" />
<br />
<img src height="200" alt="이미지 미리보기..." />
<button @click="doConvert">다운로드</button>
</div>
</div>
</template>