Skip to content

Instantly share code, notes, and snippets.

View schan90's full-sized avatar

SCHAN90 schan90

View GitHub Profile
@schan90
schan90 / xxf.zsh-theme
Created September 20, 2017 20:33 — forked from summer-wu/xxf.zsh-theme
Yet another theme for oh-my-zsh
# Copy and self modified from ys.zsh-theme, the one of default themes in master repository
# Clean, simple, compatible and meaningful.
# Tested on Linux, Unix and Windows under ANSI colors.
# It is recommended to use with a dark background and the font Inconsolata.
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
# http://xiaofan.at
# 2 Jul 2015 - Xiaofan
# Machine name.
function box_name {
### 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)
// 컬렉션 중심 프로그래밍의 4가지 유형과 함수
// 1. 수집하기 - map > values, pluck 등
// 2. 거르기 - filter > reject, compact, without 등
// 3. 찾아내기 - find > some, every 등
// 4. 접기 - reduce > min, max, group_by, count_by
###########
function _is_object(obj) {
return typeof obj == 'object' && !!obj;
}
<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