Skip to content

Instantly share code, notes, and snippets.

View danidiaz's full-sized avatar

Daniel Díaz Carrete danidiaz

View GitHub Profile
anonymous
anonymous / gist:1406238
Created November 29, 2011 20:09
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@pchiusano
pchiusano / InvertControl.hs
Created December 27, 2011 23:05
Programmatic translation to iteratees from pull-based code
{-# LANGUAGE Rank2Types, ImplicitParams #-}
import Control.Monad.Reader
import Control.Monad.Trans
-- Skip nodes let us do filtering without lookahead
-- uncons is then a simple loop that removes any Skip nodes
data Step a s = Empty | Yield a s | Skip s
newtype ListT f a = ListT { runListT :: f (Step a (ListT f a)) }
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@msluyter
msluyter / gist:1925069
Created February 27, 2012 16:22
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@michaelt
michaelt / RedBlackTree.hs
Created May 11, 2012 15:01 — forked from rampion/RedBlackTree.hs
red-black trees in haskell, using GADTs and Zippers (and DataKinds)
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DataKinds#-}
{-# LANGUAGE KindSignatures#-}
module RedBlackTree where
data Nat = Zero | Succ Nat deriving (Eq, Ord, Show)
type One = Succ Zero
@esmooov
esmooov / checkout.md
Created May 31, 2012 15:54
The Secret Passions of Git Checkout

The Secret Passions of Git Checkout


The Hand of God

Master Hand

Git checkout can do almost anything ... or, at least, many things. It can switch branches. It can mix and match branches. It can resolve merge conflicts. It can give you a scratchpad to test things. It can even be used to interactively patch files. It's so powerful because it's so abstract. But much like numinous mystics, abstraction makes it confusing.

Basically git checkout does two things:

@leandrosilva
leandrosilva / ClientApp.java
Created June 7, 2012 07:01
My MessagePack-RPC sample: Clojure Server & Java Client
package msgpack.rpc.sample.client;
import org.msgpack.rpc.Client;
import org.msgpack.rpc.loop.EventLoop;
public class ClientApp {
private static class SpawnRequest {
private SpawnRequest(final int clientCount, final int requestCount, final RPCInterface iface) {
new Thread(new Runnable() {
public void run() {
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

# development.pp
stage { 'req-install': before => Stage['rvm-install'] }
class misc {
package {
[
'vim',
]:
ensure => installed,
}
@monperrus
monperrus / gist:3761429
Created September 21, 2012 13:21
Table data extraction with Selenium 2
WebDriver webDriver = new FirefoxDriver();
webDriver.navigate().to("http://example.com/some/page");
// simplified: find table which contains the keyword
WebElement tableElement = webDriver.findElement(By.xpath("//table[contains(text(), 'Username')]"));
// create empty table object and iterate through all rows of the found table element
ArrayList<HashMap<String, WebElement>> userTable = new ArrayList<HashMap<String, WebElement>>();
ArrayList<WebElement> rowElements = tableElement.findElements(By.xpath(".//tr"));