Skip to content

Instantly share code, notes, and snippets.

View btc's full-sized avatar
🍃

brian tiger chow btc

🍃
View GitHub Profile
package main
import (
"encoding/csv"
"fmt"
"io"
"log"
"os"
"strconv"
)
Thu Mar 5 02:59 2015 Time and Allocation Profiling Report (Final)
023 +RTS -p -RTS
total time = 27.02 secs (27016 ticks @ 1000 us, 1 processor)
total alloc = 61,124,138,024 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
divisors.\ Main 48.4 33.6
import Data.Ord()
import Data.List.Ordered (member)
import Data.List (sort)
main :: IO()
main = do
let limit = 28123
let sumsOfTwoAbundantNumbers = sort $ pairwiseSums $ takeWhile (<limit) abundantNumbers
let notASum = not . flip member sumsOfTwoAbundantNumbers
package db
import (
api "github.com/danmane/abalone/go/api"
"github.com/jinzhu/gorm"
)
type gamesDB struct {
db *gorm.DB
}
@btc
btc / -
Created February 16, 2015 23:34
{\"lossThreshold\":8,\"marblesPerMove\":3,\"movesRemaining\":200,\"nextPlayer\":\"White\",\"board\":{\"whitePositions\":[[-4,3],[-4,4],[-3,3],[-3,4],[-2,2],[-2,3],[-2,4],[-1,2],[-1,3],[-1,4],[0,2],[0,3],[0,4],[1,3]],\"boardRadius\":5,\"blackPositions\":[[-1,-3],[0,-4],[0,-3],[0,-2],[1,-4],[1,-3],[1,-2],[2,-4],[2,-3],[2,-2],[3,-4],[3,-3],[4,-4],[4,-3]]}}
@btc
btc / -
Created February 16, 2015 23:33
"{\"lossThreshold\":8,\"marblesPerMove\":3,\"movesRemaining\":200,\"nextPlayer\":\"White\",\"board\":{\"whitePositions\":[[-4,3],[-4,4],[-3,3],[-3,4],[-2,2],[-2,3],[-2,4],[-1,2],[-1,3],[-1,4],[0,2],[0,3],[0,4],[1,3]],\"boardRadius\":5,\"blackPositions\":[[-1,-3],[0,-4],[0,-3],[0,-2],[1,-4],[1,-3],[1,-2],[2,-4],[2,-3],[2,-2],[3,-4],[3,-3],[4,-4],[4,-3]]}}"
@btc
btc / -
Created February 16, 2015 23:32
encode start @?= "{\"lossThreshold\":8,\"marblesPerMove\":3,\"movesRemaining\":200,\"nextPlayer\":\"White\",\"board\":{\"whitePositions\":[[-4,3],[-4,4],[-3,3],[-3,4],[-2,2],[-2,3],[-2,4],[-1,2],[-1,3],[-1,4],[0,2],[0,3],[0,4],[1,3]],\"boardRadius\":5,\"blackPositions\":[[-1,-3],[0,-4],[0,-3],[0,-2],[1,-4],[1,-3],[1,-2],[2,-4],[2,-3],[2,-2],[3,-4],[3,-3],[4,-4],[4,-3]]}}",
@btc
btc / index.js
Created February 15, 2015 12:33
// Generated by CoffeeScript undefined
var React;
React = require('react/addons');
module.exports = React.createClass({
displayName: "SpinKit",
getDefaultProps: function() {
return {
cssRequire: false,
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2zBVYFhd1GRcdqbRFA1YR/Wlb58x9Cp1U1jwjUz2azxuIdnAhDZOaLy0KalCa6r78rensO9hz0vR83RRxvkzfP3nOf9oDL2+bcaXeEUiT6l2TVCoJbfqaNylRVI7oTsqjwrPJWXoy1jSV7nM6lDgjnZH1jAycEM0Yl8DkD/RsqrzItSM9pIIopf3o2osWa05KYfiw+y8S7cyIXEl3vSW6qFlc/Dtenr54aNGnFMszKXQwF1AdicjrYxclIbkWz/b6++kjsTZ8CZUo84S5AbB3QHywdELGn41y30cf4h5hrX75RqMImHHHHeeAfkuvZS5kv/RrbCl65y6hTwvWKSz7 btc@Brians-MacBook-Pro.local
package gamecenter
import (
"bytes"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
)