Skip to content

Instantly share code, notes, and snippets.

View dyokomizo's full-sized avatar

Daniel Yokomizo dyokomizo

View GitHub Profile
@dyokomizo
dyokomizo / Rotator.java
Created September 9, 2011 14:04
A comparison of implementations of rotate.
import java.util.List;
public interface Rotator {
<T> void ror(int distance, List<T> list);
<T> void rol(int distance, List<T> list);
}
@dyokomizo
dyokomizo / gist:1392525
Created November 24, 2011 23:45
Miracles
data Never
data Once = Once
miracle :: (Never -> a) -> (a -> Once) -> Once
miracle = undefined -- let's keep the mystery...
*Main> miracle miracle
<interactive>:1:9:
@dyokomizo
dyokomizo / README.md
Created December 6, 2011 08:45 — forked from mbbx6spp/README.md
Best UNIX shell-based tools I can't live without with example usages

Best UNIX Shell tools

These are a list of usages of shell commands I can't live without on UNIX-based systems.

Install

Mac OS X

Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages:

@dyokomizo
dyokomizo / README.md
Created December 6, 2011 08:46 — forked from mbbx6spp/README.md
Idea for getting GitHub URLs for various needs

GitHub (Bash) Shell URLs

Local Shell setup

This is an environment file to source upon shell startup (via .bashrc/.bash_profile or your shell's corresponding file). If your shell isn't Bash you will likely need to port the functions to your shell's syntax.

Setup your local clone of a GitHub repo

When inside your local Git clone of a Github repo you need to do the following (only once per repo):

@dyokomizo
dyokomizo / RestAgent.java
Created February 27, 2012 12:54
RestAgent
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.client.ResponseHandler;
// Inspired by http://www.bizcoder.com/index.php/2010/08/28/agent-fielding-is-on-a-mission/
public interface RestAgent {
// set the current URI
RestAgent goTo(URI uri);
@dyokomizo
dyokomizo / gist:2171465
Created March 23, 2012 14:58
HTTP via LOLcats
> POST /cookies
< 201 I maded you a cookie
< Location /cookies/1
> GET /cookies/1
< 410 But I ated it
@dyokomizo
dyokomizo / Foo.java
Created March 24, 2012 16:07
Reflection performance
package functional;
class Foo {
public String bar() {
if (System.currentTimeMillis() > 0) {return null;}
return "baz";
}
}
@dyokomizo
dyokomizo / gist:2204549
Created March 26, 2012 11:39 — forked from copumpkin/Routing.agda
Routing
module Routing where
open import Function hiding (type-signature)
open import Data.Bool hiding (_≟_)
open import Data.Maybe
open import Data.Char hiding (_≟_)
open import Data.String as String
open import Data.List as List hiding ([_])
open import Data.Product hiding (curry; uncurry)
@dyokomizo
dyokomizo / Linefy.hs
Created April 20, 2012 11:27
Linefy
-- An implementation of http://blog.8thlight.com/uncle-bob/2012/04/20/Why-Is-Estimating-So-Hard.html
type Size = Int
type Word = String
type Line = String
linefy :: Size -> [Word] -> [Line]
linefy s ws = go [] ws
where go [] (w:ws) | length w > s = []
| otherwise = go [w] ws
go (l:ls) (w:ws) | length w > s = []
| length w + 1 + length l > s = go (w:l:ls) ws
@dyokomizo
dyokomizo / GITHUB-COMPARE-LINKS.md
Created June 21, 2012 04:16 — forked from mbbx6spp/GITHUB-COMPARE-LINKS.md
This Gist is worth a million beers. So buy me one (or send me a really cool t-shirt, make sure it is REALLY cool though)! :)