Skip to content

Instantly share code, notes, and snippets.

View ragklaat's full-sized avatar

Richard Ilyes ragklaat

  • Budapest, Hungary
View GitHub Profile
@ragklaat
ragklaat / shoutcast.html
Created October 18, 2014 18:22
Playing shoutcast stream with audiojs
<html>
<head>
<script src="lib/audiojs/audio.min.js" type="text/javascript"></script>
<script>
audiojs.events.ready(function() {
var as = audiojs.createAll();
});
</script>
</head>
<body>
@ragklaat
ragklaat / SystemOutTest.java
Created September 24, 2014 08:29
JUnit test for methods writing to OutputStream
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class SystemOutTest {
@ragklaat
ragklaat / .gitignore
Created September 1, 2014 13:04
Java .gitignore
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file
local.properties
@ragklaat
ragklaat / drag_n_drop.html
Created August 29, 2014 17:24
Drag & drop images to HTML5 canvas
<!doctype html>
<html>
<head>
<title>Drag n drop test</title>
<style type="text/css">
body {text-align: center; padding-top: 100px;}
em {position: absolute; bottom: 0; right: 0}
canvas { border: 1px solid black; }
</style>
@ragklaat
ragklaat / downloadAndUnzip.java
Last active October 5, 2017 13:18
Download and unzip files directly without saving zipped file
// warning: this uses only core Java tools and can unzip .zip files only
// warning: you should care about exceptions. Seriously.
private static boolean downloadAndUnzip(String downloadFileUrl,
String outputFile) throws MalformedURLException, IOException,
URISyntaxException {
byte[] buffer = new byte[1024];
ZipInputStream zis = new ZipInputStream(new URI(downloadFileUrl)