Skip to content

Instantly share code, notes, and snippets.

@swcho
swcho / Makefile
Last active August 29, 2015 14:27
kill test
all:
gcc main.cpp -o kill
@swcho
swcho / Load Data
Last active August 26, 2015 13:00
Zeppelen Example 1
%sh
mkdir linkage
cd linkage/
wget https://archive.ics.uci.edu/ml/machine-learning-databases/00210/donation.zip
unzip donation.zip
unzip 'block_*.zip'
ls
@swcho
swcho / post-commit
Created August 28, 2015 12:38
git hook homework
#!/bin/bash
#
# Put this script as .git/hooks/post-commit
echo -e "JSON Posting post-commit Example Script\n"
LOG_JSON=$(git log -1 --pretty=format:'{\n "commit": "%H",\n "parent": "%P",\n "author": "%an <%ae>",\n "date": "%ad",\n "message": "%f"\n}' $@)
echo -e $LOG_JSON
@swcho
swcho / async_await.ts
Created May 20, 2016 06:00
promise 2 generator
(async function setup() {
let j = jenkins.getJenkins();
let Family = aApp.models['Family'];
let Project = aApp.models['Project'];
let Job = aApp.models['Job'];
try {
await Family.destroyAll();
await Project.destroyAll();
await Job.destroyAll();
@swcho
swcho / subpage.tsx
Created September 21, 2016 11:27
React Component Sub Classing With TypeScript
import * as React from 'react';
import { Link } from 'react-router';
import { _TR } from '../../common/language';
import * as utils from '../../common/utils';
import * as appinfo from '../../common/api.appinfo';
interface TTabInfo {
title: string;
subUrl: string;
@swcho
swcho / marked.js
Created October 12, 2016 09:08
marked.js for table width generation
/**
* marked - a markdown parser
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
* https://github.com/chjj/marked
*/
;(function() {
/**
* Block-Level Grammar
@swcho
swcho / member.ts
Last active November 1, 2016 05:56
요청과 응답
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { RouteComponentProps, Link } from 'react-router';
import { Provider, connect } from 'react-redux';
import * as classNames from 'classnames';
import * as state from '../../common/state';
import * as reducer from '../../common/reducer';
import * as actions from '../../common/actions';
@swcho
swcho / dist.sh
Created November 9, 2016 04:51
Distribute To Branch
#!/bin/bash
set -e
GIT_REPO_ROOT=$(git rev-parse --show-toplevel)
if [ "$GIT_REPO_ROOT" != "$PWD" ]; then
echo "Should run this script in the repository root";
exit 1;
fi
@swcho
swcho / parent.tsx
Created March 14, 2017 09:15
Dynamic hoc
height = -1;
leftMenu;
registerHeightChange(element: React.ReactElement<{}>) {
const Component = element.type['WrappedComponent'];
const orig = Component.prototype.componentDidUpdate;
const thiz = this;
Component.prototype.componentDidUpdate = function() {
// console.log(this);
const self = ReactDOM.findDOMNode(this);
if (thiz.height !== self.clientHeight) {