Skip to content

Instantly share code, notes, and snippets.

Thread(Runnable {
val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.github.com/users/square/repos")
.build()
val response = client.newCall(request).execute()
val responseText = response.body()!!.string()
val repos = Gson().fromJson(responseText, GitHubRepositoryInfo.List::class.java)
android.util.Log.d("Repos", repos.joinToString { it.name })
}).start()
public class Main {
public static void main(String[] args) {
Calculator calculator = new Calculator();
if (calculator.calc("2 + 2") != 4) throw new RuntimeException();
if (calculator.calc("2 - 2") != 0) throw new RuntimeException();
if (calculator.calc("2 * 2") != 4) throw new RuntimeException();
if (calculator.calc("2 / 2") != 1) throw new RuntimeException();
}
@kolmakovruslan
kolmakovruslan / recursively_remove_file.md
Created February 24, 2015 12:14
Recursively remove file
find . -name ' _file_name_ ' -type f -delete
@kolmakovruslan
kolmakovruslan / js_stick_aside.md
Last active August 29, 2015 14:15
JavaScript stick aside
var $stick = $('aside');
var $foot = $('footer');
var $footer_padding = 100;
var stick_offtop = $(document).height() - $stick.height() - $footer_padding;
var stick_scrolltop = $(window).scrollTop();

$(window).scroll(function () {
	stick_scrolltop = $(window).scrollTop();
	if (ms_scrtop > ms_offtop) {
@kolmakovruslan
kolmakovruslan / joomla_article_link.md
Last active August 29, 2015 14:15
Joomla article link

index.php?option=com_content&view=article&id= article_id