Skip to content

Instantly share code, notes, and snippets.

@odoku
odoku / debug_smtp.py
Created October 29, 2013 03:30
デバッグ用のSMTPサーバー。 起動すると送信したメールの内容がコンソールに出力されるよ。 日本語対応済。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import smtpd
import asyncore
import email
from email.message import Message
from email.header import decode_header
from email.utils import parseaddr
from optparse import OptionParser
@odoku
odoku / fields.py
Created October 29, 2013 03:21
DjangoのForm用のフィールドクラス。 ハイフン毎にフィールドを分ける様な電話番号入力の時に使うと良いよ。
#-*-coding=utf8-*-
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.forms.widgets import MultiWidget
class SplitPhoneNumberWidget(MultiWidget):
u"""
電話番号ウィジェット
[te1]-[te2]-[te3]みたいな感じで入力が出来るよ。
@odoku
odoku / imagemagick.rb
Last active October 16, 2018 04:58
Homebrew Formula ImageMagick version 6.7.7-6.
# some credit to https://github.com/maddox/magick-installer
require 'formula'
def ghostscript_srsly?
build.include? 'with-ghostscript'
end
def ghostscript_fonts?
File.directory? "#{HOMEBREW_PREFIX}/share/ghostscript/fonts"
end
@odoku
odoku / like_django_php_framework.php
Created March 29, 2012 08:02
DjangoみたいなPHPフレームワークが欲しい。
<?php
//
// Routing.php
// ===========================================================================+
return urlpatterns(array(
url('^$', 'content.view.index', 'index'),
include_urlpatterns('^/friend/', 'content.urls', 'friend'),
));