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
""" | |
A simple lotto game. | |
It creates random lotto tickets according to a user-defined shape, and then draws numbers at random | |
to check which ticket has all of its numbers matched first, becoming the winner. | |
""" | |
import random | |
import platform | |
import os |
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
Failed: -35 EAGAIN | |
[error] java.lang.RuntimeException: Nonzero exit code: 1 | |
[error] at scala.sys.package$.error(package.scala:27) | |
[error] at scala.scalanative.sbtplugin.ScalaNativePluginInternal$.$anonfun$scalaNativeConfigSettings$45(ScalaNativePluginInternal.scala:432) | |
[error] at scala.Option.foreach(Option.scala:257) | |
[error] at scala.scalanative.sbtplugin.ScalaNativePluginInternal$.$anonfun$scalaNativeConfigSettings$44(ScalaNativePluginInternal.scala:432) | |
[error] at scala.scalanative.sbtplugin.ScalaNativePluginInternal$.$anonfun$scalaNativeConfigSettings$44$adapted(ScalaNativePluginInternal.scala:417) | |
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) | |
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39) | |
[error] at sbt.std.Transform$$anon$4.work(System.scala:66) |
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
#My first Sonic Pi thingy! | |
live_loop :lead_bass do | |
with_fx :reverb, room: 1 do | |
with_fx :echo do | |
p = [1, -1].choose | |
sample :bass_thick_c, pan: p | |
sample :bd_boom, amp: 4, rate: 1, pan: -p | |
sample :loop_garzul, rate: [0.5, 1].choose | |
sleep 8 |
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
trait Parser[A] { | |
def apply(s: String): Option[A] | |
} | |
import scala.util.Try | |
implicit val stringParser: Parser[String] = new Parser[String] { | |
def apply(s: String): Option[String] = Some(s) | |
} |
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 com.example.concurrent; | |
import android.os.Handler; | |
import android.os.Looper; | |
import java.util.concurrent.Executor; | |
/** | |
* When the calling thread has a Looper installed (like the UI thread), an instance of ExecuteOnCaller will submit | |
* Runnables into the caller thread. Otherwise it will submit the Runnables to the UI thread. |
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
# --- !Ups | |
CREATE TABLE users( | |
email VARCHAR(255) NOT NULL PRIMARY KEY, | |
name VARCHAR(255) | |
); | |
CREATE TABLE subjects( | |
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
title LONGTEXT NOT NULL, |