This file contains hidden or 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 Looper { | |
| public static void main(String[] args) throws Exception { | |
| int five = 5; | |
| Field field = Integer.class.getDeclaredField("value"); | |
| field.setAccessible(true); | |
| field.set(five, 4); | |
| for (Integer i = 0; i < 10; i++) { | |
| System.out.println(i); |
This file contains hidden or 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 nl.jqno.equalsverifier; | |
| import org.apache.commons.lang3.builder.EqualsBuilder; | |
| import org.apache.commons.lang3.builder.HashCodeBuilder; | |
| import org.junit.Test; | |
| public class ApacheDoubleTest { | |
| static final class Doubler { | |
| private final double d; |
This file contains hidden or 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 void waitAMinute() { | |
| reallyReallyWait(60000); | |
| } | |
| public void reallyReallyWait(int millis) { | |
| int before = System.currentTimeMillis(); | |
| try { | |
| Thread.sleep(millis); | |
| } | |
| catch (InterruptedException | StackOverflowError e) { |
This file contains hidden or 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 net.sf.cglib.proxy.Enhancer; | |
| import net.sf.cglib.proxy.NoOp; | |
| import org.jetbrains.annotations.NotNull; | |
| import org.junit.Test; | |
| public class MyObjectTest { | |
| @Test | |
| public void shouldVerifyHashCodeEquals() { | |
| Enhancer e = new Enhancer(); |
This file contains hidden or 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
| // My implementation of Cedric Beust's coding challenge: | |
| // | |
| // A School has either a name (“Stanford”) or a nickname (“UCSD”) or both. | |
| // | |
| // Your task is to write equals() and hashCode() methods for the School class | |
| // that satisfy the following requirement: two Schools are identical if they | |
| // either have the same name or the same nickname. | |
| // | |
| // http://beust.com/weblog/2013/02/13/coding-challenge-light-edition/ |
This file contains hidden or 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
| function _fancy_prompt { | |
| local RED="\[\033[01;31m\]" | |
| local GREEN="\[\033[01;32m\]" | |
| local YELLOW="\[\033[01;33m\]" | |
| local BLUE="\[\033[01;34m\]" | |
| local WHITE="\[\033[00m\]" | |
| local PROMPT="" | |
| # Working directory |
This file contains hidden or 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.parboiled.scala._ | |
| import org.parboiled.errors.ErrorUtils | |
| import org.junit.runner.RunWith | |
| import org.scalatest.FlatSpec | |
| import org.scalatest.junit.JUnitRunner | |
| import org.scalatest.matchers.ShouldMatchers | |
| @RunWith(classOf[JUnitRunner]) | |
| class IsolationTest extends FlatSpec with ShouldMatchers { | |
| val input = "abcdxyz" |
This file contains hidden or 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
| # Add the following line to ~/.bashrc: | |
| # . /path/to/this/script/run.sh script_folder | |
| # For example: | |
| # . ~/Dropbox/config/bash/run.sh session | |
| # Don't forget the dot! | |
| for f in `dirname ${BASH_SOURCE[0]}`/$1/*; do | |
| . $f | |
| done |
This file contains hidden or 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
| if has('win32') || has('win64') | |
| set runtimepath+=$HOME/Dropbox/config/vim | |
| source ~\Dropbox\config\vim\vimrc.vim | |
| else | |
| set runtimepath+=~/Dropbox/config/vim | |
| source ~/Dropbox/config/vim/vimrc.vim | |
| endif |
This file contains hidden or 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 net.liftweb.common | |
| import org.junit.runner.RunWith | |
| import org.scalatest.FlatSpec | |
| import org.scalatest.junit.JUnitRunner | |
| import org.scalatest.matchers.ShouldMatchers | |
| @RunWith(classOf[JUnitRunner]) | |
| class BoxTest extends FlatSpec with ShouldMatchers { | |
| val foo = "foo" |
NewerOlder