Skip to content

Instantly share code, notes, and snippets.

View kumikoda's full-sized avatar
🧎‍♂️
Summoning AI God

Anson Chu kumikoda

🧎‍♂️
Summoning AI God
View GitHub Profile
# a simple two line prompt with color
source ~/git-prompt.sh
GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
cyan='\e[0;36m'
blue='\e[0;34m'
green='\e[0;32m'
reset="\e[0m"
PS1="${blue}\u@\h ${cyan}\w${green} \$(__git_ps1) ${reset}\n\$ "
@kumikoda
kumikoda / timeout.html
Last active February 8, 2022 15:59
A simple example demonstrating how setTimeout(fn, 0) can be useful. This gist illustrates the answer given by DVK's on stackoverflow. http://stackoverflow.com/a/4575011/783478
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<button id='do'> Do long calc!</button>
<div id='status'></div>
<div id='result'></div>
<script>
$('#do').on('click', function(){
set nocompatible
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim " path to dein.vim
call dein#begin(expand('~/.cache/dein')) " path to plugins dir
call dein#add('Shougo/dein.vim') " the plugin manager itself
call dein#add('Shougo/deoplete.nvim') " autocomplete
call dein#add('scrooloose/nerdtree') " file tree explorer
call dein#add('vim-airline/vim-airline') " status bar
call dein#end()
@kumikoda
kumikoda / set-timeout.py
Created June 9, 2017 00:19
set timeout in python
import heapq
import time
class runtime:
def __init__(self):
self.heap = []
def setTimeout(self, fn, timeout):
exp = time.time() + timeout
@kumikoda
kumikoda / game-of-life.py
Created June 9, 2017 00:19
game of life in python
from sets import Set
class Game:
def __init__(self, state):
self.state = state
def next(self):
new_state = Set()
for cell in state:
@kumikoda
kumikoda / fifo.py
Created June 9, 2017 00:18
fifo queue in python
class Fifo:
def __init__(self, size):
self.size = size
self.count = 0
self.q = [None] * size
self.head = 0
self.tail = 0
def push(self, elm):
print self.count
@kumikoda
kumikoda / squash.md
Last active June 3, 2017 14:09
squashing your commits
  1. Make sure you have the latest code
git fetch --all 
git log
  1. start rebasing. If you have a feature branch you want to merge, you might rebase off dev. If you simply want to squash a few commits together, you might rebase off of a specific head location.
@kumikoda
kumikoda / npm_version_patch.md
Last active January 4, 2016 06:58
How to bump version number for your own package (that you don't need to publish to npm)
  1. make your changes and merge your stuff into master
  git push origin master
  1. Bump your version number in package.json, add a new tag and commit
  npm version patch
@kumikoda
kumikoda / backbone_memleak_free.coffee
Last active December 22, 2015 16:49
a memory leak FREE backbone template
class Item extends Backbone.Model
class ItemList extends Backbone.Collection
class ItemView extends Backbone.View
template : _.template '<%= text %>'
initialize : ->

A love story written by me

Characters

Nick : an elevator engineer Laura : a beautiful girl Betsy : an intelligent elevator robot Shane : the simpleton