THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
| render | |
| for each particle | |
| x, y = particle.position | |
| color = sample( colorMap, x, y ) | |
| noise = sample( noiseMap, x, y ) | |
| angle = noise * PI * 2 | |
| particle.velocity.add( cos(angle), sin(angle) ) |
| package transactions | |
| import com.twitter.finagle.exp.mysql.{Client, OK, Result} | |
| class Db(mysqlClient: Client) { | |
| val insertOrder = "INSERT INTO orders (ref) VALUES(?)" | |
| val insertOrderItem = "INSERT INTO order_items (order_id, item_id) VALUES(?, ?)" | |
| def persistOrderWithItems[T](order: Order)(whenDone: (OK, Seq[Result]) => T): Future[T] = { |
| import cats.{Id,Monad} | |
| import cats.state.State | |
| import cats.std.function._ | |
| import scala.language.higherKinds._ | |
| // Call Example.example.run to see the example running | |
| object Example { | |
| type MyState[A] = State[Int, A] |
| # UDEV rules to setup automatic backup upon disk insertion | |
| # You can get the discriminant informations with the following command : | |
| # udevinfo -a -p $(udevinfo -q path -n /dev/sda) | |
| KERNEL=="sd?1", ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{vendor}=="Maxtor", ATTRS{model}=="Basics Portable", RUN+="/root/autobackup.sh %k" |
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x| Welcome to the Ammonite Repl 0.8.0 | |
| (Scala 2.11.8 Java 1.8.0_91) | |
| @ import scala.util.Try | |
| import scala.util.Try | |
| @ val listOfTries: List[Try[String]] = List(Try("a"), Try("b"), Try("c")) | |
| listOfTries: List[Try[String]] = List(Success("a"), Success("b"), Success("c")) | |
| // I have a List[Try[String]] but I actually want a Try[List[String]]. |
| apt install peco | |
| apt install curl | |
| curl http://localhost:8081/subjects | jq .[] | tr -d "\"" | peco | xargs -I '{}' curl -v -X DELETE http://localhost:8081/subjects/'{}' |