Skip to content

Instantly share code, notes, and snippets.

View nondeterministic's full-sized avatar

Andreas Bauer nondeterministic

View GitHub Profile
import java.net.{SocketOptions, Inet4Address, InetAddress, Socket}
import java.util.concurrent.TimeoutException
import akka.actor.{ActorRef, Props, ActorSystem}
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpMethods._
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.ws._
import akka.io.Inet
import akka.routing.BroadcastGroup
/**
* A toggle switch with two labels. Modeled after: https://codemyui.com/toggle-switch-with-lables/
*/
object ToggleSwitchWithLabels {
private var toggled = true
def apply(labelOn: String, labelOff: String) = {
def onClick = {
println("on click: " + toggled)
toggled = !toggled
@ochrons
ochrons / WorkerMain.scala
Created May 25, 2016 19:59
Web Worker PoC in Scala.js
package poc
import org.scalajs.dom
import scala.scalajs.js
import scala.scalajs.js.annotation.JSExport
@js.native
object WorkerGlobal extends js.GlobalScope {
def addEventListener(`type`: String, f: js.Function): Unit = js.native
@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.