Skip to content

Instantly share code, notes, and snippets.

View enif-lee's full-sized avatar
๐Ÿ˜

enif.lee enif-lee

๐Ÿ˜
View GitHub Profile
public class LogUtil {
static int log2 (int number) {
int logCount = 0;
if(65536 <= number) { logCount += 16; number >>= 16; }
if(256 <= number) { logCount += 8; number >>= 8; }
if(16 <= number) { logCount += 4; number >>= 4; }
if(4 <= number) { logCount += 2; number >>= 2; }
return logCount + (2 <= number ? 1 : 0);
}
}
class TestTimeout
{
static void Main(string[] args)
{
new Timeout(
start: () =>
{
Thread.Sleep(10000);
Console.WriteLine("it's working!");
},
void move(int from, int to){
printf("\nMove from %d to %d", from, to);
}
// n๊ฐœ์˜ ์›๋ฐ˜์„ from ์—์„œ by๋ฅผ ๊ฑฐ์ณ to๋กœ ์˜ฎ๊ธด๋‹ค.
void hanoi(int n, int from, int by, int to){
if (n == 1)
move(from, to);
else{
hanoi(n - 1, from, to, by); // 1๋ฒˆ N-1๊ฐœ์˜ ์›๋ฐ˜์„ ๊ธฐ๋‘ฅ3์„ ๊ฑฐ์ณ 2๋กœ ์˜ฎ๊ธด๋‹ค.
public class LogUtil {
static int log2 (int number) {
int logCount = 0;
while(number>>=1 > 0) logCount++;
return logCount;
}
}
using System;
namespace Samples
{
/// <summary>
/// ๋™๊ธฐ์ ์œผ๋กœ ์žฌ์‹œ๋„๋ฅผ ํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ๋˜๋Š” retry ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
/// </summary>
public class Retry
{
/// <summary>
@enif-lee
enif-lee / settings.json
Last active February 4, 2017 15:29
Settings json file for java developer
{
"editor.tabSize": 3,
"editor.insertSpaces": false,
"editor.renderWhitespace": "boundary",
"editor.detectIndentation": false,
"editor.wrappingColumn": 1000,
"workbench.welcome.enabled": true,
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"explorer.openEditors.visible": 0
}
@enif-lee
enif-lee / vue.js
Created February 7, 2017 14:55
vue.js router guard
import Vue from 'vue'
import VueRouter from 'vue-router'
import firebase from 'firebase'
import signIn from './sign-in.vue'
Vue.use(VueRouter);
const router = new VueRouter({
routes: [
{
@enif-lee
enif-lee / vue.js
Created February 7, 2017 14:55
vue.js router guard
import Vue from 'vue'
import VueRouter from 'vue-router'
import firebase from 'firebase'
import signIn from './sign-in.vue'
Vue.use(VueRouter);
const router = new VueRouter({
routes: [
{
@enif-lee
enif-lee / router.js
Last active February 8, 2017 01:14
router.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import firebase from 'firebase'
import {Message} from 'element-ui'
import signIn from './sign-in.vue'
Vue.use(VueRouter);
var routes = {
root: {
git config --global alias.st status
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.cm "commit -m "
git config --global alias.l 'log --color --graph --pretty=oneline --decorate --date=short --abbrev-commit --branches'
git config --global alias.ds 'diff --stat'
git config --global diff.tool vimdiff
git config --global merge.tool vimdiff
git config --global difftool.prompt false