Skip to content

Instantly share code, notes, and snippets.

View lqd's full-sized avatar
💭
I may be slow to respond.

Rémy Rakic lqd

💭
I may be slow to respond.
View GitHub Profile
package org.hybird.tests.ui;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
@lqd
lqd / gist:1726656
Created February 3, 2012 00:11
Lombok.val loop semantics modification
int i = 0;
for (val s = "", j = 2; i < 1; ++i) // having different types for local variables is illegal in Java :)
{
System.out.printf("s (%s): '%s'\n", s.getClass().getName(), s);
System.out.printf("j: '%s'\n", j);
}
@lqd
lqd / gist:1986550
Created March 6, 2012 14:25
Paginated view iterator for jcouchdb
import java.util.Iterator;
import java.util.List;
import lombok.var;
import org.jcouchdb.db.Database;
import org.jcouchdb.db.Options;
import org.jcouchdb.document.ValueAndDocumentRow;
import org.jcouchdb.document.ValueRow;
@lqd
lqd / gist:1986698
Created March 6, 2012 15:02
Lombok-free paginated view iterator for jcouchdb (cf https://gist.github.com/1986550)
import java.util.Iterator;
import java.util.List;
import org.jcouchdb.db.Database;
import org.jcouchdb.db.Options;
import org.jcouchdb.document.Document;
import org.jcouchdb.document.ValueRow;
import org.jcouchdb.document.ViewResult;
// Fast view pagination method described at http://guide.couchdb.org/draft/recipes.html#fast
@lqd
lqd / gist:1c841dea193698bf50fefa19c6b3fb99
Last active December 10, 2023 19:17
Some of my favorite development streams and shows
Why coding streams/shows are interesting to me: in some livestreams, the experience is very similar to pair programming,
but those people are experts. In VODs, it's more about problem solving and learning skills and approaches. The devs are really good
at what they do and there is *always* a lot to learn.
In no particular order:
1) Handmade Hero
About the author: Casey Muratori. Worked at RAD.
Description and why I like it: It kinda started the whole thing for me. Casey is coding a complete game and engine on stream,
from scratch, one hour a day. He knows what he's doing on so many of the domains of game development and regular programing,
@lqd
lqd / operators.wast
Created June 20, 2016 12:59
Example of mir2wasm on operators.rs. Manually modified to import print, calling it on the test method from the binaryen interpreter
(module
(memory 0)
(type $rustfn-0-11 (func (param i32 i32) (result i32)))
(type $rustfn-0-22 (func (param i32 i32) (result i32)))
(type $rustfn-0-33 (func (param i32 i32) (result i32)))
(type $rustfn-0-44 (func (param i32 i32) (result i32)))
(type $rustfn-0-48 (func (param i32 i32) (result i32)))
(type $rustfn-0-47 (func))
(func $_isize_as_Add_::add (type $rustfn-0-11) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
@lqd
lqd / div.wast
Created June 20, 2016 21:32
binaryen-shell ./wast/div.wast == Abort trap: 6
(module
(memory 0)
(type $rustfn-0-47 (func))
(func $test (type $rustfn-0-47)
(block
(call_import $print_i32
(i32.div
(i32.const 4)
(i32.const 2)
)
#![allow(unused_features)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![feature(intrinsics, lang_items, start, no_core, libc, fundamental)]
#![no_core]
#[lang = "sized"]
#[fundamental]
pub trait Sized { }
(module
(memory 0)
(type $rustfn-0-14 (func (param i32 i32) (result i32)))
(type $rustfn-0-28 (func (param i32 i32) (result i32)))
(type $rustfn-0-39 (func (param i32 i32) (result i32)))
(type $rustfn-0-42 (func (param i32) (result i32)))
(type $rustfn-0-44 (func (param i32 i32) (result i32)))
(export "main" $main)
(func $fibonacci_recursive (type $rustfn-0-42) (param $0 i32) (result i32)
(local $1 i32)
--- stdout
detected home dir change, cleaning out entire build directory
--- stderr
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 145, message: "Le r\u{e9}pertoire n\u{201
9}est pas vide." } }', ../src/libcore\result.rs:746
stack backtrace:
0: 0xb7f78a - std::rt::lang_start::h5b0863080165c75e
1: 0xb66ad3 - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
2: 0xb68140 - std::sys_common::unwind::begin_unwind_fmt::h64c0ff793199cc1b