Skip to content

Instantly share code, notes, and snippets.

View dahlia's full-sized avatar
⚰️
Off work for the bereavement of my father

Hong Minhee (洪 民憙) dahlia

⚰️
Off work for the bereavement of my father
View GitHub Profile
@dahlia
dahlia / xmlbuild.php
Created March 25, 2010 06:09
xmlbuild.php
<?php
class XmlBuilder {
function __call($tag, array $contents) {
$content = '';
foreach ($contents as $c) {
if ($c instanceof XmlBuilder_Element) {
$content .= $c;
} else if (is_array($c)) {
$attrs = array_merge($array, $c);
@dahlia
dahlia / .gitignore
Created March 25, 2010 06:25
pager.py
*.pyc
.*.swp
MANIFEST

List comprehension

Map

The following code generates times-table:

times-table := [x * y, x: 2 ~ 9, y: 1 ~ 9]

The code is equivalent to:

@dahlia
dahlia / .gitignore
Created August 8, 2010 18:20
Questions
questions.pyc
questions.sqlite3
@dahlia
dahlia / app.yaml
Created August 17, 2010 07:13
미투데이 PyPI 피드
application: me2pypi
version: 1
runtime: python
api_version: 1
handlers:
- url: /update
script: me2pypi.py
login: admin
- url: .*
@dahlia
dahlia / lisp.rb
Created September 2, 2010 07:52
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
@dahlia
dahlia / index.php
Created October 28, 2010 17:11
Simple Image Resizing API
<?php
# Simple Image Resizing API
#
# A simple HTTP API for resizing an image (given by the URL).
# This small and dirty ad hoc web application is entirely written in
# PHP 5.3+ with GD. The source code is distributed under Public License.
function is_url($string, $scheme = null) {
$url = parse_url($string);
if (!isset($url['scheme'])) return false;
@dahlia
dahlia / magic_image_crawler.py
Created December 27, 2010 12:13
Magic Image Crawler!
#!/usr/bin/env python
""":mod:`magic_image_crawler` --- Magic Image Crawler!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This small program crawls the URL and download only most important images of
the page. Trivial images like buttons, banners are ignored.
"""
import re
import itertools
@dahlia
dahlia / gist:817255
Created February 8, 2011 21:09
Requirements of a weblog software I want to use

Here I describe requirements of a weblog software I want to use.

  • Plaintext file-based: Posts should be stored as plaintext in the filesystem. This property could useful for revision control of posts.
  • Multiple markup formats: Posts should be able to written in various markup formats like Markdown and reStructuredText. If the filename of the post has a suffix .rst, it should be rendered in HTML docutils (or it would be Pandoc, of course)
@dahlia
dahlia / example.naru
Created March 9, 2011 08:20
Narusegawa, a micro web framework in Naru
import narusegawa
app := narusegawa Application()
app get("/", fun
return "Hello world!"
end)