Skip to content

Instantly share code, notes, and snippets.

View schan90's full-sized avatar

SCHAN90 schan90

View GitHub Profile
### define function variable before block to avoid code being appended to closing part of JSDoc comment ###
cube = ''
###*
* Funtion to calculate cube of input
* @param {number} Number to operate on
* @return {number} Cube of input
###
cube = (x) -> x*x*x
@schan90
schan90 / graphql-sample.py
Created September 14, 2017 10:24 — forked from achimnol/graphql-sample.py
GraphQL Sample in Python
import asyncio
import base64
import enum
import secrets
from pprint import pprint
import graphene
from graphql.execution.executors.asyncio import AsyncioExecutor
@schan90
schan90 / useHexo.md
Created September 13, 2017 04:09 — forked from btfak/useHexo.md
How to use Hexo and deploy to GitHub Pages
@schan90
schan90 / gist.md
Created August 28, 2017 10:03 — forked from benbalter/gist.md
Example of how to embed a Gist on GitHub Pages using Jekyll.

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

@schan90
schan90 / rbenv-howto.md
Created August 24, 2017 06:27 — forked from MicahElliott/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@schan90
schan90 / mergeSort.js
Created August 24, 2017 01:34 — forked from dsernst/mergeSort.js
Merge Sort in JavaScript
var mergeSort = function(array) {
if (array.length === 1) {
return array
} else {
var split = Math.floor(array.length/2)
var left = array.slice(0, split)
var right = array.slice(split)
left = mergeSort(left)
right = mergeSort(right)
<html><head></head><body>
<section id="todo"></section>
<script>
const TaskState = class {
static addState(key, cls) {
const v = new cls();
if (!(v instanceof TaskState)) throw 'invalid cls';
if ((TaskState._subClasses || (TaskState._subClasses = new Map())).has(key)) throw 'exist key';
TaskState._subClasses.set(key, cls);
}
@schan90
schan90 / powerset.iterative.js
Created August 10, 2017 01:11 — forked from lokothodida/powerset.iterative.js
Javascript implementation(s) of a Power Set function
/* Calculates the power set, P(s) := { s' : s' is a subset of s }
* Assumes an implementation of a Set that has the following methods:
* add, equals, forEach, clone
*/
var powerSet = function(set) {
var prevSet = new Set(); // prevSet := {}
var currSet = new Set().add(new Set()); // currSet := { {} }
// Main loop will continually add elements to currSet until no
// new elements are added
@schan90
schan90 / powerset.js
Created August 10, 2017 01:01 — forked from mLuby/powerset.js
Generate power set from a string
function powerset (input) {
return input
.split(input ? '' : false)
.filter(duplicates({}))
.map(concatEmptyStr)
.reduce(multiplyMatrix)
}
function concatEmptyStr (str) {
return str ? ['', str] : ['']
@schan90
schan90 / MySQL table into CSV file 1.sql
Created August 9, 2017 05:27 — forked from gaerae/MySQL table into CSV file 1.sql
MySQL Table의 데이터를 CSV 형태로 내보내기 방법에는 여러가지가 있습니다. 어떤 방법으로만 해야된다가 아닌 상황에 맞게 사용하는게 좋을 거 같습니다. 4 가지 예시입니다.
SELECT * FROM my_table
INTO OUTFILE 'my_table.csv'
CHARACTER SET euckr
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'