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
padStart list = 0 : list | |
padEnd list = list ++ [0] | |
next l = zipWith (+) (padEnd l) (padStart l) | |
pascal d | |
| d <= 0 = [] | |
| d == 1 = [1] | |
| d == 2 = [1, 1] | |
| otherwise = next $ pascal $ d - 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
package logic; | |
import org.junit.Test; | |
import play.test.UnitTest; | |
public class RssToPostTestV1 extends UnitTest { | |
public static final String USER_ID = "[email protected]"; | |
public static final String URL = | |
"http://shpilenok.livejournal.com/data/rss"; |
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 logic; | |
public class WordWrap { | |
public static String wrap(String input, int length) { | |
return null; | |
} | |
} |
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 logic; | |
import org.junit.Assert; | |
import org.junit.Test; | |
import play.Play; | |
import java.util.Properties; | |
public class IsolatedTestV1 extends Assert { | |
static { |
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 logic; | |
import org.junit.Assert; | |
import org.junit.Before; | |
import org.junit.Test; | |
import java.util.List; | |
import static org.hamcrest.CoreMatchers.is; | |
import static org.junit.matchers.JUnitMatchers.hasItem; |
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 logic; | |
import org.junit.Assert; | |
import org.junit.Test; | |
import org.w3c.dom.Document; | |
import play.libs.XML; | |
import static org.mockito.Matchers.any; | |
import static org.mockito.Mockito.doNothing; | |
import static org.mockito.Mockito.doReturn; |
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.IOException; | |
import java.net.URL; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
public class Main { | |
public static void main(String[] args) throws IOException { |
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
@Test | |
public void comparing_date_and_timestamp() throws Exception { | |
long millis = 1383057201173L; | |
java.sql.Timestamp timestamp = new java.sql.Timestamp(millis); | |
java.util.Date date = new java.util.Date(millis); | |
//wtf | |
assertTrue(date.equals(timestamp)); | |
assertTrue(date.after(timestamp)); |
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 f in ls *.doc ; do calligraconverter "$f" $(echo "out/${f%.doc}" | sed 's/[ ,.-]//g').epub; done; | |
find . -name "*.epub" -exec unzip {} -d {}.dir \; | |
zip -X title.epub mimetype | |
zip -rg title.epub META-INF | |
zip -rg title.epub OEBPS |
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
@Test | |
public void test() throws Exception { | |
final BigDecimal Z0 = new BigDecimal("0"); | |
final BigDecimal Z1 = new BigDecimal("0.0"); | |
final BigDecimal Z2 = new BigDecimal("0.00"); | |
final BigDecimal Z5 = ZERO.setScale(5); | |
assertFalse(Z0.equals(Z1)); | |
assertFalse(Z1.equals(Z2)); |
OlderNewer