Skip to content

Instantly share code, notes, and snippets.

View yayitswei's full-sized avatar

Wei Hsu yayitswei

  • San Francisco, CA
View GitHub Profile
@yayitswei
yayitswei / winning.clj
Created June 26, 2013 17:57
winning states
(def winning-states
[
[1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1]
[0 0 0 1
0 0 1 0
0 1 0 0
1 0 0 0]
(defroutes all-routes
socket-routes
(wrap-restful-format api-routes)
(wrap-friend-auth app-routes)
(route/resources "/")
(route/not-found "Not Found"))
{:user {:plugins [[lein-localrepo "0.4.1"]
[lein-tarsier "0.9.4"]
[lein-clojars "0.9.1"]
[compojure-app/lein-template "0.2.7"]
[leinjacker "0.4.1"]
[http-kit/lein-template "1.0.0-SNAPSHOT"]
[lein-cljsbuild "0.3.0"]
[lein-pprint "1.1.1"]
[starter/lein-template "0.1.4-SNAPSHOT"]]
:injections [(require 'spyscope.core)
(def app
(wrap-restful-format (wrap-request-logging
(if prod?
(handler/site all-routes)
(reload/wrap-reload (handler/api #'all-routes))))))
bitcoin.core=> (def network (testNet))
#'bitcoin.core/network
bitcoin.core=> (start)
#<Transition com.google.common.util.concurrent.AbstractService$Transition@562ccf18>
bitcoin.core=> (.getId (net))
"org.bitcoin.test"
bitcoin.core=> (def w (open-wallet "./testWallet.wallet"))
#'bitcoin.core/w
bitcoin.core=> w
#<Wallet Wallet containing 0.00 BTC in:
@yayitswei
yayitswei / gist:5377652
Created April 13, 2013 08:53
Connection to repository.jboss.org refused
wei:wall wei$ lein ring server
Retrieving aleph/aleph/0.3.0-beta15/aleph-0.3.0-beta15.pom from clojars
Retrieving org/clojure/data.xml/0.0.7/data.xml-0.0.7.pom from central
Retrieving io/netty/netty/3.6.2.Final/netty-3.6.2.Final.pom from central
Retrieving lamina/lamina/0.5.0-beta14/lamina-0.5.0-beta14.pom from clojars
Retrieving org/clojure/tools.logging/0.2.4/tools.logging-0.2.4.pom from central
Retrieving org/flatland/useful/0.9.0/useful-0.9.0.pom from clojars
Retrieving potemkin/potemkin/0.2.0/potemkin-0.2.0.pom from clojars
Retrieving gloss/gloss/0.2.2-beta5/gloss-0.2.2-beta5.pom from clojars
Retrieving lamina/lamina/0.5.0-beta9/lamina-0.5.0-beta9.pom from clojars
define(["scripts/match"], function(cycle, main){
var Gadget = function(player, config, $el) {
cljs.match.init(player, config, $el);
player.on('toggleEdit', this.toggleEdit, this);
player.on('configChange', this.update, this);
player.on('render', this.render, this);
};
This file has been truncated, but you can view the full file.
;(function(){
var CLOSURE_NO_DEPS = true;
var COMPILED = false;
var goog = goog || {};
goog.global = this;
goog.DEBUG = true;
goog.LOCALE = "en";
goog.provide = function(name) {
if(!COMPILED) {
if(goog.isProvided_(name)) {
@yayitswei
yayitswei / gist:5297098
Created April 2, 2013 23:20
requirejs format
define([], function(){
return function(){
return Math.floor(Math.random() * 100) + 1;
}
});
wei:classnotes wei$ irb
irb(main):001:0> a = [{:a=>1}, {:a=>2}]
=> [{:a=>1}, {:a=>2}]
irb(main):003:0> a.sort! {|a, b| a[:a] <=> b[:a]}
=> [{:a=>1}, {:a=>2}]
irb(main):004:0> b = [{:a => 1}]
=> [{:a=>1}]
irb(main):005:0> b.sort! {|a, b| a[:a] <=> b[:a]}
=> [{:a=>1}]