Skip to content

Instantly share code, notes, and snippets.

View xlc's full-sized avatar

Xiliang Chen xlc

View GitHub Profile

Keybase proof

I hereby claim:

  • I am xlc on github.
  • I am bryan_chen (https://keybase.io/bryan_chen) on keybase.
  • I have a public key ASAbgVm-oIEZQcWvGB7nOL-wwFoe-jSG3LcGJj7JGY8pRgo

To claim this, I am signing this object:

@xlc
xlc / test.swift
Last active December 7, 2016 04:17
func someCondition(_: Int) -> Bool {
return true
}
func foo() {
func loop(_ index: Int) {
if (index < 100) {
if someCondition(index) {
return loop(index + 3)
} else {
@xlc
xlc / var.cpp
Created October 24, 2014 05:01
#include <cassert>
#include <deque>
#include <functional>
#include <algorithm>
#include <memory>
template <class TArg, class TFriend = void>
class Event {
friend TFriend;
class Wrapper<T> {
let _val: T[]
init(_ v: T) {
_val = [v]
}
func __conversion() -> T {
return _val[0]
}
import Cocoa
class A : NSObject {
init() { }
}
class B : A {
@xlc
xlc / mock
Last active August 29, 2015 14:02
struct Point3D {
var x: Int
var y: Int
var z: Int
}
protocol Point3DGenerator {
mutating func next() -> Point3D
}
#include <iostream>
#include <typeinfo>
#include <type_traits>
#include <functional>
#include <tuple>
using namespace std;
int TestCount = 0;
@xlc
xlc / iterator.cpp
Last active December 30, 2015 10:49
#include <vector>
#include <iostream>
#include <utility>
#include <functional>
#include <type_traits>
#include <memory>
namespace xlc
{
template <class TIterator, class TSelectFunc>
@xlc
xlc / test.m
Last active December 12, 2015 02:48
how to create instance even alloc return nil
#import "AppDelegate.h"
#import <objc/runtime.h>
#import <objc/message.h>
@interface Test : NSObject
@end