Skip to content

Instantly share code, notes, and snippets.

<form action="" method="" role="form">
<fieldset>
<legend>Your Contact Info</legend>
<div>
<label for="first-name" title="First Name"><span>F</span>irst name</label>
<input accesskey="f" autofocus id="first-name" name="first-name" role="input" tabindex="1" type="text">
</div>
<div>
<label for="last-name" title="Last Name"><span>L</span>ast name</label>
<input accesskey="l" id="last-name" name="last-name" role="input" tabindex="2" type="text">
body { background:rgb(255,255,255); font-family:sans-serif; font-size:62.5%; }
form { margin:5em auto; width:40em; }
fieldset {
border-color:rgb(230,230,230);
border-style:solid;
border-width:0 0 0 0.5em;
margin-bottom:3em;
position:relative;
@canwe
canwe / inception-javascript.js
Created May 23, 2012 14:15 — forked from fcalderan/inception-javascript.js
inception explained as a 4 nested javascript closures
/*
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02
* I had an idea: could Inception movie be explained by a few javascript closures
* and variable resolution scope (just for fun)?
*
* Activate javascript console =)
*/
<script>
console.group("inception movie");
@canwe
canwe / latency.markdown
Created July 5, 2012 14:19 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@canwe
canwe / latency.markdown
Created July 5, 2012 14:19 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

package math.recreational.generators;
import java.util.Iterator;
public class PalindromeGenerator implements Iterator<Long> {
private Long current = 0l;
@Override
public boolean hasNext() {
val newSession = additionalSessionParams.foldLeft[Session](request.session) { _ + _ }
val r: PlainResult = action(request).asInstanceOf[PlainResult]
// workaround since withSession calls aren't composable it seems
val innerSession = r.header.headers.get(SET_COOKIE).map(cookies => Session.decodeFromCookie(Cookies.decode(cookies).find(_.name == Session.COOKIE_NAME)))
if(innerSession.isDefined) {
// there really should be an API method for adding sessions
val combined = innerSession.get.data.foldLeft(newSession) { _ + _ }
r.withSession(combined)
} else {
package com.diese.ems.setup.structure.employee.sbt;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import java.io.IOException;
import java.net.InetSocketAddress;
/*****************
* bossFight.js *
*****************
*
* NO FARTHER, DR. EVAL!!!!
* YOU WILL NOT GET OUT OF HERE ALIVE!!!!
* IT'S TIME YOU SEE MY TRUE FORM!!!!
* FACE MY ROBOT WRATH!!!!!
*/
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>keytool-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<id>clean</id>
<goals>