Skip to content

Instantly share code, notes, and snippets.

View draftcode's full-sized avatar

Masaya Suzuki draftcode

View GitHub Profile
@draftcode
draftcode / cygpath.vim
Created December 14, 2012 04:31
Convert cygwin style file path.
" quickrun: hook/cygpath: Convert source file path.
" Author: draftcode <draftcode@gmail.com>
" License: zlib License
let s:save_cpo = &cpo
set cpo&vim
let s:hook = { 'config': { 'enable': 0 } }
function! s:hook.on_normalized(session, context)
@draftcode
draftcode / virtualenv.vim
Created December 14, 2012 04:29
Use virtualenv python if available
" quickrun: hook/virtualenv: Use virtualenv python if available
" Author: draftcode <draftcode@gmail.com>
" License: zlib License
let s:save_cpo = &cpo
set cpo&vim
let s:hook = {
\ 'config': {
\ 'enable': 0,
@draftcode
draftcode / gist:4012016
Created November 4, 2012 13:53
WindowManager test
extern "C" {
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include <X11/extensions/Xinerama.h>
}
int main(void) {
Display *display(XOpenDisplay(nullptr));
if (!display) return 1;
package com.github.draftcode;
import roboguice.activity.RoboActivity;
import roboguice.inject.InjectExtra;
import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends RoboActivity {
@InjectExtra("test")
String a;
@draftcode
draftcode / gist:3332278
Created August 12, 2012 15:25
何かが間違っている……
|- let rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1)))) in ((sum (fun x -> (x * x))) 2) evalto 5 by E-LetRec {
sum = ()[rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1))))] |- ((sum (fun x -> (x * x))) 2) evalto 5 by E-App {
sum = ()[rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1))))] |- (sum (fun x -> (x * x))) evalto (sum = ()[rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1))))] , f = (sum = ()[rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1))))])[fun x -> (x * x)])[fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1)))] by E-AppRec {
sum = ()[rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1))))] |- sum evalto ()[rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1))))] by E-Var1 {
};
sum = ()[rec sum = fun f -> (fun n -> if (n < 1) then 0 else ((f n) + ((sum f) (n - 1))))] |- (fu
@draftcode
draftcode / gist:3224733
Created August 1, 2012 07:55
Conversion FunctionとConstructor
#include <iostream>
using namespace std;
struct C;
struct D {
operator C();
};
struct C {
C() {}
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Or Target.Column = 5 Then
Dim value As String
value = "" & Target.value
If Len(value) = 6 Then
Target.value = "平成" & Int(Mid(value, 1, 2)) & "年" & _
Int(Mid(value, 3, 2)) & "月" & _
Int(Mid(value, 5, 2)) & "日"
End If
End If
(new AsyncTask<Void, Void, Void>() {
protected Void doInBackground(Void... params) {
executeOauth();
return null;
}
}).execute();
require 'formula'
class BinutilsXv6 < Formula
url 'http://ftpmirror.gnu.org/binutils/binutils-2.21.1a.tar.bz2'
mirror 'http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2'
homepage 'http://www.gnu.org/software/binutils/binutils.html'
md5 'bde820eac53fa3a8d8696667418557ad'
def install
system "./configure", "--target=i386-jos-elf",
class Holder {
private int n;
public Holder(int n) { this.n = n; }
public void assertSanity() {
if (n != n) {
throw new AssertionError("This statement is false.");
}
}
}