Skip to content

Instantly share code, notes, and snippets.

Chris Yuen kizzx2

Block or report user

Report or block kizzx2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kizzx2
kizzx2 / package.json
Created Jun 30, 2015
Simple node-http-proxy with HTTPS
View package.json
{
"name": "node-https-proxy",
"version": "1.0.0",
"description": "",
"main": "auth.js",
"scripts": {
"start": "node_modules/LiveScript/bin/lsc server.ls"
},
"dependencies": {
"LiveScript": "^1.3.1",
View keybase.md

Keybase proof

I hereby claim:

  • I am kizzx2 on github.
  • I am kizzx2 (https://keybase.io/kizzx2) on keybase.
  • I have a public key whose fingerprint is C0CD 8083 90F9 F949 183D 9341 B81F 73A5 E3FD 582F

To claim this, I am signing this object:

@kizzx2
kizzx2 / test.rb
Created May 10, 2014
Run single test with Spring in Rails 4.1
View test.rb
require 'optparse'
$: << Rails.root.join('test')
options = {}
OptionParser.new do |opts|
opts.on('-n TEST_NAME') do |n|
options[:test_name] = n
end
opts.on('-e ENVIRONMENT') do |e|
View build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
configurations {
apt
}
@kizzx2
kizzx2 / build.gradle
Last active Aug 29, 2015
Using Gradle to handle dependencies for (Ant based) Android projects
View build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
// Define your dependencies here
compile 'com.google.guava:guava:16.0.1'
}
View mongoid-update-attributes.rb
require 'mongoid'
require 'minitest'
require 'minitest/autorun'
class Foo
include Mongoid::Document
field :x, type: Integer
field :y, type: Integer
end
View foo.js
var docs = [];
for(var i = 0; i < 20000; i++) {
docs.push({rnd: _rand(), t: "2013-06-23", N:7*i, A:1, V:0, n:"1234"});
}
docs.sort(function(a, b) {
return a.rnd - b.rnd;
});
var t0 = Date.now();
db.foos.insert(docs);
@kizzx2
kizzx2 / fun.cpp
Last active Mar 2, 2019
Illustrative C++ Lua binding example/tutorial
View fun.cpp
// fun.cpp
// This is for Lua 5.2, for Lua 5.1, see https://gist.github.com/kizzx2/1594905
#include <lua.hpp>
#include <iostream>
#include <sstream>
class Foo
{
@kizzx2
kizzx2 / tmux-sync.sh
Last active Apr 29, 2019
Run multiple commands, and open them all in synchronized tmux panes
View tmux-sync.sh
#!/bin/sh
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Chris Yuen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@kizzx2
kizzx2 / post.rb
Created Feb 6, 2013
A clean and elegant approach to partial object validation with Rails + Wicked wizards (store partial object in database)
View post.rb
class Post < ActiveRecord::Base
attr_accessible :body, :price, :title
validates_presence_of :title
validates_length_of :title, minimum: 10
validates_presence_of :body
validates_numericality_of :price, greater_than: 0
end
You can’t perform that action at this time.