Skip to content

Instantly share code, notes, and snippets.

View draftcode's full-sized avatar

Masaya Suzuki draftcode

View GitHub Profile
#!/usr/bin/env python
class Application(object):
def __init__(self, lhs, rhs):
self.lhs = lhs
self.rhs = rhs
def __repr__(self):
if isinstance(self.rhs, Variable):
return str(self.lhs) + str(self.rhs)
#include <iostream>
using namespace std;
typedef unsigned long long ull;
ull pow(ull p, ull n) {
ull w = 1;
for (ull i = 1ULL << (sizeof(ull)*8-1); i != 0; i >>= 1) {
if ((n & i) == 0) {
w *= w;
class Property(object):
def __init__(self):
self.name = None
def setup_name(self, obj, cls):
for k, v in cls.__dict__.iteritems():
if v is self:
self.name = k
obj.__dict__[k] = None
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import threading
class Segment(object):
version_count = 0
def __init__(self, parent):
"""
Args:
.class public hello
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit stack 2
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "Hello, World"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
return
.end method
.class public A
.super java/lang/Object
.method static method()F
fconst_1
freturn
.end method
.method static method()I
iconst_1
@draftcode
draftcode / gist:1357281
Created November 11, 2011 05:35
構文解析 Howto

構文解析 Howto

Author: draftcode
Date: 2011-11-11T13:18:07+09:00
ID:289a0136-0c1c-11e1-a06b-040ccee352e6

こうぶん、かいせきー

#include <iostream>
#include <string>
using namespace std;
int main(void) {
string s("abc\0abc");
cout << s.length() << endl; // 3
cout << distance(s.begin(), s.end()) << endl; // 3
string t("abcdabc");
#import <Foundation/Foundation.h>
@class A;
@protocol P
- (A*)f;
@end
@interface A : NSObject <P>
- (A*)f;
#import <Foundation/Foundation.h>
@interface ClassA : NSObject
@end
@implementation ClassA
@end
@interface ClassB : NSObject
@end