Skip to content

Instantly share code, notes, and snippets.

View zwang's full-sized avatar
😀
Plato App

Zhao Wang zwang

😀
Plato App
View GitHub Profile
#include "mach_gettime.h"
#include <mach/mach_time.h>
#define MT_NANO (+1.0E-9)
#define MT_GIGA UINT64_C(1000000000)
// TODO create a list of timers,
static double mt_timebase = 0.0;
static uint64_t mt_timestart = 0;
@HamptonMakes
HamptonMakes / RBResizer.swift
Created June 27, 2014 14:45
Swift Image Resizer
//
// RBResizer.swift
// Locker
//
// Created by Hampton Catlin on 6/20/14.
// Copyright (c) 2014 rarebit. All rights reserved.
//
import UIKit
@staltz
staltz / introrx.md
Last active May 20, 2024 14:59
The introduction to Reactive Programming you've been missing
@bsima
bsima / clojure-resources.md
Last active October 25, 2016 15:35
As I'm learning Clojure, I'm finding all kinds of awesome resources for learning, tools for building and testing, etc. Here's what I'm finding.

For most of the tools on here, if you follow the GitHub repos back to the user that owns the repo, they usually have other cool Clojure tools they build. Just a general observation about the Clojure community.

Learnings

  • Clojure home - There's a ton of good stuff here, like the rationale behind the design and explanations of the best features of Clojure.
  • Clojure.github.io - The core Clojure documentation. Useful for looking up functions and such.
  • Clojuredoc - Community written Clojure documentation and articles
  • Clojure Koans - Learn Clojure with Koans
  • 4Clojure - Solve simple problems to stretch your Clojure skills
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
def countChange(money: Int, coins: List[Int]): Int =
if (money < 0 || coins.isEmpty)
0
else if (money == 0)
1
else
countChange(money - coins.head, coins) + countChange(money, coins.tail)
@marnix
marnix / scala-di-from-comment-7789930.scala
Created March 2, 2012 06:27
This code is a copy (roughly reconstructed from reformatted and reordered parts in an abandoned Eclipse project) of the code that was originally in http://jonasboner.com/2008/10/06/real-world-scala-dependency-injection-di.html#comment-7789930.
trait BeeperDevice {
def beep(beepSound: String)
}
trait DependsOnBeeper {
protected val beeper: BeeperDevice
}
class Beeper extends BeeperDevice {
@aemkei
aemkei / LICENSE.txt
Created October 27, 2011 17:16 — forked from 140bytes/LICENSE.txt
Lorenz Attractor - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@joelnet
joelnet / example.html
Created June 3, 2011 18:03
Unobtrusive Knockout support library for jQuery
Choose a ticket class: <select id="tickets"></select>
<p id="ticketOutput"></p>
<script id="ticketTemplate" type="text/x-jquery-tmpl">
{{if chosenTicket}}
You have chosen <b>${ chosenTicket().name }</b>
($${ chosenTicket().price })
<button data-bind="click: resetTicket">Clear</button>
{{/if}}