This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** nigga wut */ | |
background: #366; | |
background: linear-gradient(25deg, #346, rgba(100,0,100,0.1)); | |
min-height: 100%; | |
font-family: monospace; | |
font-size: 48pt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Q = require('kew'); | |
function retryPromise(n, mkPromise) { | |
if(n > 0) | |
return mkPromise() | |
.fail(function(){ | |
console.log('failed promise, retrying maximum ' + n + ' more times'); | |
return retryPromise(n - 1, mkPromise); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit classs FancyString(s : String) { | |
def awesomeStuff = string.reverse.toUpperCase | |
} | |
"awesomeStuff".awesomeStuff | |
def cool(implicit thing: Int) = thing * 3 | |
implicit val something = 21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.typesafe.sbt.SbtStartScript | |
seq(SbtStartScript.startScriptForClassesSettings: _*) | |
seq(Revolver.settings: _*) | |
name := "demo" | |
organization := "com.scalapenos" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.inject.*; | |
import org.nnsoft.guice.sli4j.core.InjectLogger; | |
import org.nnsoft.guice.sli4j.slf4j.Slf4jLoggingModule; | |
import org.slf4j.Logger; | |
class Stuff { | |
public int randomNumber() { | |
return (int)(Math.random() * Integer.MAX_VALUE); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.Rect; | |
import android.graphics.drawable.shapes.Shape; | |
/** | |
* Centered string shape | |
*/ | |
class StringShape extends Shape | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.lang.Math.max; | |
import static java.lang.Math.min; | |
public class Math | |
{ | |
// clamp(n) = n such that min <= final <= max | |
public static final int clamp(final int min, final int value, final int max) | |
{ | |
return max(min, min(value, max)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# I first create the large file, so we are sure this has nothing to do with stream piping | |
node create_large_file.js > large.json | |
# on my machine this crashes on 133949 | |
cat large.json | node nothing.js | |
#.... | |
#133949 | |
#FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ES='http://localhost:9200' | |
# avoid colorizing when using less | |
if [ -t 1 ]; then | |
alias pp='python -mjson.tool | pygmentize -l javascript' | |
else | |
alias pp='python -mjson.tool' | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
(** Simple streams created by iteration of one operator *) | |
Section monoid_iter. | |
Context `{Monoid M} (m:M). | |
(** The infinite stream s, m & s, m & m & s, ... *) | |
CoFixpoint inf_iter (start:M) : ∞M := | |
start ::: inf_iter (m & start). | |