Skip to content

Instantly share code, notes, and snippets.

View mattn's full-sized avatar
🍛
I love curry 🍛

mattn mattn

🍛
I love curry 🍛
View GitHub Profile
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <signal.h>
#include <unistd.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <aio.h>
package HtmlHandler;
use Moose;
extends 'Tatsumaki::Handler';
sub get {
my $self = shift;
my ( $track ) = @_;
$self->render( 'index.html' );
}
@cho45
cho45 / AutoInstall.pm
Created August 3, 2010 09:38
AutoInstall modules from CPAN with cpanm
package AutoInstall;
# perl -MAutoInstall pl.pl
use strict;
use warnings;
BEGIN {
push @INC, sub {
my ($self, $filename) = @_;
my ($modulename) = ($filename =~ /^(.*)\.pm$/m);
@mattn
mattn / bulkupload.sh
Created August 5, 2010 05:22
vimjolts development tools
#!/bin/sh
python ../appcfg.py upload_data --config_file=package_loader.py --filename=package.csv --kind=Package --url=http://vimjolts.appspot.com/remote_api

vimjolts

DSL

フォーマットはJSONとかの方がいい。

いろんなフォーマット吐けるようにする。

require "rubygems"
require "dl/import"
module Lib_MSVCRT extend DL::Importer
LC_CTYPE = 2
dlload "msvcrt.dll"
extern "char* setlocale(int, char*)"
end
Lib_MSVCRT::setlocale(Lib_MSVCRT::LC_CTYPE, "")
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u"( ゚∀゚)o彡゜おっぱい!おっぱい!"
@gintenlabo
gintenlabo / optional_ref.hpp
Created October 19, 2010 14:29
boost::optional<T&> の省メモリな代替
//
// etude::optional_ref<T>
// ポインタの安全で軽快な代替として使えるクラス
// 一部を除き boost::optional<T&> と同じように使えます。
// 詳しくは http://d.hatena.ne.jp/gintenlabo/20101019/1287500776 を参照。
//
// Copyright (C) 2010 Takaya Saito (SubaruG).
// このコードは NYSL (http://www.kmonos.net/nysl/) の下で公開されています。
// 自分で書いたコードと同じように、自由に利用、改変、再配布を行って構いません。
// 何かあったら: gintensubaru あっと gmail.com まで。
var Typd = function(endpoint) {
this.endpoint = endpoint || 'http://api.typepad.com';
};
Typd.prototype = {
endpointUrlBuilder: function() {
var _typd = this;
return {
assets: function() {
return {
'get': function(id) {
@tyru
tyru / .vimrc
Created November 1, 2010 13:12
function! s:is_changed() "{{{
try
" When no `b:vimrc_changedtick` variable
" (first time), not changed.
return exists('b:vimrc_changedtick')
\ && b:vimrc_changedtick < b:changedtick
finally
let b:vimrc_changedtick = b:changedtick
endtry
endfunction "}}}