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
ol | |
>, ,+ | |
li | |
list-style-type decimal |
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 org.junit.Assert; | |
import org.junit.Test; | |
public class Sandbox { | |
public static void main(final String[] args) { | |
} | |
@Test | |
public void test() { |
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
public class FindView { | |
public static In in(final View view) { | |
return new In() { | |
@Override | |
@SuppressWarnings("unchecked") | |
public View byId(final int id) { | |
return view.findViewById(id); | |
} | |
}; | |
} |
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
package me.fixpoint.sandbox.java; | |
import static java.lang.Math.max; | |
class Solution { | |
public static void main(String[] args) { | |
System.out.println(new Solution().sequence(new int[] { 9, 10, 2, -1, 3, -5, 0, -3, 1, 12, 5, 8, -2, 6, 4 })); | |
} | |
private static final int NONE = -1; |
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
// Original | |
void indexOf(int[] haystack, int needle) { | |
for (int i = 0; i < haystack.length; i++) { | |
if (haystack[i] == needle) { | |
return i; | |
} | |
} | |
return -1; | |
} |
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
(defmacro chain-rebind [var-name init-value & cmds] | |
(let [init-binding `(~'temp ~init-value) | |
cmd-to-binding (fn [cmd] `(~'temp (binding [~var-name ~'temp] ~cmd))) | |
cmd-bindings (map cmd-to-binding cmds) | |
bindings-list (cons init-binding cmd-bindings) | |
bindings (apply concat bindings-list)] | |
`(let ~(vec bindings) ~'temp))) | |
Usage: |
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
for (String x = "Blah"; x != null; x = null) { | |
System.out.println("OMG"); | |
} | |
0: ldc #19 // String Blah | |
2: astore_1 | |
3: goto 16 | |
6: getstatic #21 // Field java/lang/System.out:Ljava/io/PrintStream; | |
9: ldc #27 // String OMG |
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
let rec hcf a b = | |
if a = 0u then b | |
elif a<b then hcf a (b - a) | |
else hcf (a - b) b | |
type Fraction = | |
{ n : uint32; d : uint32 } | |
override this.ToString() = | |
if (this.d = 1u) |
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
#!/usr/bin/awk -f | |
BEGIN { FS = ""; prev = "" } | |
{ | |
prefix = ""; n = 1 | |
while ((n <= NF) && ($n == substr(prev, n, 1))) { | |
if ($n == "/") { prefix = substr($0, 1, n) } | |
n++ | |
} |
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 XMonad | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Util.EZConfig(additionalKeys) | |
import XMonad.Layout.LayoutModifier | |
import qualified XMonad.StackSet as W | |
import XMonad.Hooks.EwmhDesktops | |
import XMonad.Hooks.ManageDocks (avoidStruts, manageDocks) | |
import XMonad.Actions.PhysicalScreens | |
import XMonad.Util.Run (spawnPipe) |
OlderNewer