Add the following line to build.gradle
in dependencies
.
compile 'com.google.android.gms:play-services:+'
/** | |
* A basic hello world in Java | |
*/ | |
public class HelloWorld { | |
public static void main(String[] args) { | |
System.out.println("Hello, world!"); | |
} | |
} |
import requests | |
for match in requests.get('http://worldcup.sfg.io/matches').json(): | |
if match['status'] == 'completed': | |
print('{home[code]} {home[goals]}, {away[code]} {away[goals]}' \ | |
.format(home=match['home_team'], away=match['away_team'])) |
def printf(format, *args, **kwargs): | |
"""printf in Python with Python 3-style format strings""" | |
print(format.format(*args, **kwargs), end='') |
#!/bin/bash | |
# | |
# This file echoes a bunch of color codes to the terminal to demonstrate | |
# what's available. Each line is the color code of one forground color, | |
# out of 17 (default + 16 escapes), followed by a test use of that color | |
# on all nine background colors (default + 8 escapes). | |
# | |
# Source: | |
# http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux | |
# |
H-99: Ninety-Nine Haskell Problems | |
================================== | |
Taken from http://www.haskell.org/haskellwiki/H-99:_Ninety-Nine_Haskell_Problems | |
Problem 1 | |
--------- | |
Find the last element of a list. |
public class A { | |
public A(Runnable preinitialization) { | |
preinitialization.run(); | |
initializeUsingSubclassMethod(); | |
} | |
} |
import java.util.function.Consumer; | |
public class A<T extends A> { | |
public A(Consumer<T> preinitialization) { | |
preinitialization.accept((T) this); | |
initializeUsingSubclassMethod(); | |
} | |
} |
import random | |
def sample(items): | |
# the first argument can be omitted as it defaults to 0 | |
randomIndex = random.randrange(len(items)) | |
return items[randomIndex] | |
def promptForGender(): | |
genderList = ["male", "female"] |
// | |
// Ideas for New Topsoil Settings API | |
// ================================== | |
// | |
// | |
// Idea #1 - Inline Everything | |
// --------------------------- | |
// |