Skip to content

Instantly share code, notes, and snippets.

#lang racket
(define (get-list l n)
(if (= n 0)
(car l)
(get-list (cdr l) (- n 1))))
(define x (list 1 2 3 4 5))
(display (get-list x 1))
(define (get-list l n)
(if (= n 0)
(car l)
(get-list (cdr l) (- n 1))))
(define (r-gen l n range)
(if (= n 1)
(r-append l range)
(r-gen (r-append l range) (- n 1) range)))
@kanghyojun
kanghyojun / Binary search
Created October 28, 2011 06:58
Binary Search in Lisp (racket-lang)
-- GrowlIt 1.2
-- Description:
-- An applescript that displays events and to-do's from iCal as Growl notifications.
-- Based on multiple other Applescripts found in multiple sites.
-- No warranty. Tested with iCal 4.0.1 and Growl 1.2 under Mac OS X Snow Leopard 10.6.2
-- Written by Leonardo Alcantara software@imagn.net
-- Last modified: 2010-03-28
---------------------------------------------------------------------------------------------------------------------------------
set myAllNotesList to {"Events"}
set appName to "GrowlIt"
@kanghyojun
kanghyojun / gist:1356907
Created November 11, 2011 01:48
3 Layout
<html>
<head>
<style>
* {
margin:0; padding: 0;
}
#top {
width: 100%; height: 50px;
background: #f00;
float:left;

#Minifier on shell script

CSS and JS minifier automation in Directory. you can choose your directory to minify and file type(only css , js)

Basically, your base minifier is a

##Usage

@kanghyojun
kanghyojun / Page.php
Created April 29, 2013 10:17
Pager class for board.
<?php
/** Pager class for php
*
* {{{
*
* $pager = new Page($all_data_length, $page_per_post_length);
* $page_html = "<ul>"
* foreach($pager.getPage($current_page) as $page) {
* $page_html = $page_html . "<li class=\"" . $page['flag'] . "\"></li>" . $page['num'] . "</li>"
* }
def draw_circle(r):
space_num = r * 2 + 1
def circle(x, y, radius):
radius_point = (x - radius)**2 + (y - radius) **2
radius_square = radius**2
correct_value = 1
if radius <= 3:
correct_value = 0.7
return radius_square * correct_value <= radius_point <= radius_square * 1.3
Array.prototype.swap = function(a, b) {
var tmp = this[a];
this[a] = this[b];
this[b] = tmp;
};
Array.prototype.qsort = function(key) {
if(key === void 0) {
key = function(x) {
return x;
###
Author: Kang Hyojun ( admire9 at gmail dot com )
Rewrite https://gist.github.com/admire93/5547195 in coffeescript
###
Array.prototype.swap = (a, b) ->
tmp = this[a]
this[a] = this[b]
this[b] = tmp