Skip to content

Instantly share code, notes, and snippets.

View shomah4a's full-sized avatar

shoma shomah4a

  • 17:22 (UTC +09:00)
View GitHub Profile
#include <iostream>
template <typename V, typename N>
class Vector
{
public:
const V value;
const N next;
Vector(const V& v, const N& n): value(v), next(n) {}
package path.to.pkg
import android.app
import android.os
import android.content
import android.hardware
import android.view
import android.hardware
import android.graphics
package path.to.pkg;
public final class Utils
{
static void YUV422toARGB8888(byte[] src, int[] dest, int w, int h)
{
final int fsize = w * h;
for (int y=0, p=0; y<h; ++y)
{
int uvp = fsize + (y >> 1) * w, U = 0, V = 0;
#-*- coding:utf-8 -*-
from wsgiref import simple_server
def teapot(environ, start_response):
start_response("418 I'm a teapot", [])
return "I'm a teapot"
@shomah4a
shomah4a / json.erl
Created January 12, 2011 16:02
Erlang で JSON をパースしてみました
%% -*- coding:utf-8 -*-
-module(json).
-export([parseJson/1]).
%% 空白飛ばし
skipSpace([]) ->
[];
skipSpace([X|XS]) when (X == $ ) or (X == $\n) or (X == $\r) or (X == $\t) ->
skipSpace(XS);
package net.shomah4a.utils.generator.continuation
import scala.util.continuations.{reset, shift, cpsParam}
object Generator
{
type GenParam[T] = (Option[T], Option[GeneratorSupport[T]])
type GenState[T] = cpsParam[GenParam[T], GenParam[T]]
@shomah4a
shomah4a / generatoractor.scala
Created January 15, 2011 09:35
Actor で Generator
package net.shomah4a.utils.generator.actor
import scala.actors
class GeneratorMessage
object StopIteration
class Yielder[T](postto: actors.Actor, msgobj: GeneratorMessage)
{
#-*- coding:utf-8 -*-
import wx
class Window(wx.Frame):
def __init__(self, *argl, **argd):
super(Window, self).__init__(*argl, **argd)
;;; ikazuchi-mode.el --- ikazuchi, translate using web APIs, minor mode.
;;;
;;; Currently can use only Google.
;;;
(provide 'ikazuchi-mode)
;; set path to ikazuchi if you have not set PATH.
(defvar ikazuchi-path "ikazuchi")
@shomah4a
shomah4a / staticmethod.py
Created March 21, 2011 10:56
staticmethod
class StaticMethod(object):
def __init__(self, f):
self.function = f
def __get__(self, *args, **argd):
return self.function