Skip to content

Instantly share code, notes, and snippets.

View chj1768's full-sized avatar

최현지 chj1768

  • Seoul, south korea
View GitHub Profile
@chj1768
chj1768 / #5.html
Last active December 11, 2018 17:05
#5
<html>
<body>
<p id="base"></p>
</body>
<script>
const Task = class{
constructor(title, date){
this._title = title,
this._date = date,
this._isComplete = false;
@chj1768
chj1768 / practice.html
Last active November 26, 2018 04:05
practice 1, 2 포함입니다.
<html>
<body id="ad">
</body>
<script>
const Task = class{
constructor(title, date){
this._title = title,
this._date = date,
this._isComplete = false;
this._list = [];
const Renderer = class {
async render(data){
if(!(data instanceof Data)) throw "invalid data type";
const info = await data.getData();
if(!(info instanceof Info)) throw "invalid info type";
this._title = info.title;
this._header = info.header;
this._items = info.items;
this._render();
}
@chj1768
chj1768 / App.jsx
Created August 10, 2017 05:33
how to use redux in react and react-router(2.8.1)
import React from 'react';
import { connect } from 'react-redux';
import { Header } from './Header.jsx';
import { Footer } from './Footer.jsx';
class AppComponent extends React.Component {
constructor( props ) {
super( props );
@chj1768
chj1768 / ErrorMixins.jsx
Created July 3, 2017 08:39
how to use mixin, publish&subscribe(meteor) in React es6
export const ErrorMixins = {
bye() {
console.log('bye');
}
};
@chj1768
chj1768 / ex.js
Last active July 3, 2017 08:23
send email with attachments using meteor.js
Meteor.methods({
sendMail( from, to, userName, attachments ) {
check( from, String );
check( to, String );
check( userName, String );
check( attachments, Array );
this.unblock();
const files = attachments.map( _ => { return { filename : 'filename', path : 'remote file url' }; } ); //example
@chj1768
chj1768 / simple_rsa
Last active December 16, 2022 07:20
RSA encryption / decryption example (nodejs)
openssl key pair generate
//client - using meteor.js
const nodersa = Npm.require('node-rsa');
import { HTTP } from 'meteor/http';
const syncPost = Meteor.wrapAsync( HTTP.post, HTTP );
encryptStringWithRsaPublicKey( data ) {
const absolutePath = Assets.absoluteFilePath( "public.key" ); //public key file path
const publicKey = fs.readFileSync( absolutePath, "utf8" );
@chj1768
chj1768 / mms_lambda.js
Created June 12, 2017 02:17
aws s3 에 파일이 업로드될 경우 트리거되는 람다로 설정하여 외부 sms api 를 통해 업로드한 파일을 mms 메시지로 전송 연동 로직
'use strict';
const https = require('https');
const FileAPI = require('file-api');
const File = FileAPI.File;
let fs = require('fs');
let async = require('async');
let aws = require('aws-sdk');
let s3 = new aws.S3( { apiVersion: '2006-03-01' } );
@chj1768
chj1768 / jwt+googlesheets.js
Created June 12, 2017 02:15
Meteor.js에서 구글 서비스 계정 인증 + 구글시트 연동 관련 로직
import { HTTP } from 'meteor/http'
let google = require('googleapis');
const serviceId = 'xxx-service-account@true-tooling-108006.iam.gserviceaccount.com';
const keyFileName = 'xxx_service_account.json';
const scopeUrl = 'https://www.googleapis.com/auth/spreadsheets';
const jwtClient = new google.auth.JWT(
serviceId, Assets.absoluteFilePath( keyFileName ), null, [ scopeUrl ]
);
jwtClient.authorize( Meteor.bindEnvironment( ( err, tokens ) => {