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 ObjectsAndEquals | |
{ | |
public static void main(String[] args) | |
{ | |
Integer m0 = 127; | |
Integer m1 = 127; | |
System.out.println(m0 == m1); // true | |
System.out.println(m0.equals(m1)); // true | |
Integer n0 = 128; |
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 com.example; | |
/** | |
* Requires java 5+ | |
*/ | |
public class FluentBuilderExample { | |
public static void main(String[] args) { | |
System.out.println(FooBuilder.create().bar().prop("setting the bar prop!").build().build().toString()); | |
} |
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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8oxgvGh9mj3DGukQ/iUeeEkkmM7NwJIAwrkYAmZIEo8kqS1fbs6S91m6/4SXYfbzd7FW7ltwNPiJrkeJahX+KiX3au29ZhtGw/SJiMWzeutHex0qkx4cgBnWFdlyrHAz/rGofSARI+PQM6jKWvTJ50JrMjt1/vy51dKRplBUHeGYLb33cTMxk1+wBznO8mDq+wbob3zqvcMqnPHp1Nm8qUdonISn49Pub1F8fgJEuaJS16pTJQxdAcY9nVq+X7K2D4MLIzeZJTPAw+FB7rQe1P7GqPmCNyGYkTrGlpo2cbO/fwmIYQqc2ND+uJSgzdB7v0KsbP9d3jNm60htWYvgD |
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 com.example; | |
public final class Interpolate { | |
private static final String pattern = "{}"; | |
public static String interpolate(String msg, Object...args) { | |
if (args == null || args.length < 1) return msg; | |
int idx = msg.indexOf(pattern); | |
if (idx == -1) return msg; |
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
/** | |
* LICENSE: wtfpl v1 or v2, at your whim | |
* | |
* @Test | |
* public void test() throws IllegalArgumentException, IllegalAccessException { | |
* String expected = "" | |
* + "| a | b | c |" | |
* + "\n|-------+------+--------|" | |
* + "\n| one | null | five |" | |
* + "\n| seven | nine | eleven |" |
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 java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import com.itextpdf.text.DocumentException; | |
import com.itextpdf.text.pdf.AcroFields; | |
import com.itextpdf.text.pdf.FdfReader; | |
import com.itextpdf.text.pdf.PdfReader; | |
import com.itextpdf.text.pdf.PdfStamper; |
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 | |
source "$(which libsolarized.sh)" | |
function fileError() { | |
local err=$1 | |
local f=$2 | |
echo "$base1$err: $base2$f$reset" | |
exit 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
#!/usr/bin/env bash | |
if [[ -z $1 || ! -f $1 ]]; then | |
exit 1 | |
fi | |
base=$1 | |
last="" |
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/bash | |
# Requires mutagen. I used 1.20 | |
# http://code.google.com/p/mutagen/ | |
# | |
# Changes artist sort tag from Last, First to just | |
# be whatever the artist name is. | |
"ls" *mp3 | while read FILE | |
do | |
TPE1=$(mid3v2 -l "$FILE" | "grep" TPE1 | cut -d= -f2) |
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 java.math.BigInteger; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class Fibonacci | |
{ | |
public static void main(String...args) | |
{ | |
// fib(new BigInteger("7886")); |
OlderNewer