Skip to content

Instantly share code, notes, and snippets.

View sirn's full-sized avatar

Sirn Thanabulpong sirn

  • Tokyo, Japan
  • 11:37 (UTC +09:00)
View GitHub Profile
;; Resize Frame on Horizontal Splitting.
;; Written by Kridsada Thanabulpong <naises@gmail.com>.
;; Published as public domain.
(setq default-width (frame-width))
(when window-system
(add-hook 'window-configuration-change-hook
'(lambda ()
(setq windows ())
(dolist (w (window-list))
(ns sesscookie.core
(:use compojure.core
ring.adapter.jetty
ring.middleware.session
ring.middleware.session.cookie))
(defn write-index [req]
{:status 200
:body (str ":demo-session " (get-in req [:session :demo-session]) "\n"
":demo-cookies " (get-in req [:cookies "demo-cookies"]))})
(ns ringcookie.core
(:use ring.adapter.jetty
ring.middleware.cookies
ring.middleware.session
ring.middleware.session.cookie))
(defn app
[req]
{:status 200
:cookies {:test-cookie "foobar"}
@sirn
sirn / wkhtmltopdf.rb
Created November 7, 2012 09:58 — forked from 2bits/wkhtmltopdf.rb
wkhtmltopdf - build formula for Homebrew supporting 0.9.9, 0.11.0_rc1, and their patched Qt4
require 'formula'
class WkhtmltopdfQt < Formula
# This is the latest staging branch commit, dated 6 JAN 2012.
url 'https://qt.gitorious.org/qt/wkhtmltopdf-qt/archive-tarball/6053b687d24956d0a7eac21a015172b29cf0f451'
sha1 '3a48649a2082ced3153bd2841d1e8a94a5e74a4f'
version '6053b68'
end
class Wkhtmltopdf < Formula
@sirn
sirn / amd_syntax.coffee
Created December 18, 2012 10:52
AMD preprocessor for CoffeeScript (experimental)
import "foobar" as FooBar
import "lorem_ipsum" as LoremIpsum
console.log FooBar
console.log LoremIpsum
@sirn
sirn / .gitignore
Created May 1, 2013 13:56
Reduced use case to demonstrate that "%" in path is causing vagrant-vmware-fusion to fail.
.vagrant/
*.pyc
class Foo < ActiveRecord::Base
has_many :bars, :include => [:user]
end
class Bar < ActiveRecord::Base
belongs_to :foo
belongs_to :user
def self.some_complex_count
joins(:somewhere_else).joins(:someother_table).where do
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist>
<dict>
<key>Label</key>
<string>com.gridth.anchor</string>
<key>ProgramArguments</key>
<array>
<string>/Users/sirn/.virtualenvs/default/bin/python</string>
<string>-m</string>
@sirn
sirn / __init__.py
Created December 25, 2013 17:37
Celery integration with Pyramid
from .tasks import celery, configure_celery
# ...
def main(global_config, **settings): # pragma: no cover
""" This function returns a Pyramid WSGI application.
"""
# ...
configure_celery(celery, settings)
# ...
@sirn
sirn / pserve
Created December 31, 2013 09:17
Python 3.2.3 (default, Sep 25 2013, 18:22:43)
[GCC 4.6.3] on linux2
Type "help" for more information.
Environment:
app The WSGI application.
registry Active Pyramid registry.
request Active request object.
root Root of the default resource tree.
root_factory Default root factory used to create `root`.