My preferred installation on MacOS:
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
sealed trait State { def count: Int } | |
case class Odd(count: Int) extends State | |
case class Even(count: Int) extends State | |
case class Emit(count: Int) extends State | |
val scanned = | |
observable.scan(Empty : State) { (state, elem) => | |
val newState = state match { | |
case Odd(count) => |
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
import monix.eval.Task | |
import java.util.concurrent.TimeUnit | |
import scala.concurrent.duration._ | |
/** Request limiter for APIs that have quotas per second, minute, hour, etc. | |
* | |
* {{{ | |
* // Rate-limits to 100 requests per second | |
* val limiter = TaskLimiter(TimeUnit.SECONDS, limit = 100) | |
* |
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
import java.security.MessageDigest | |
import java.util | |
import javax.crypto.Cipher | |
import javax.crypto.spec.SecretKeySpec | |
import org.apache.commons.codec.binary.Base64 | |
/** | |
* Sample: | |
* {{{ | |
* scala> val key = "My very own, very private key here!" |
Firefox Add-on: https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/
For getting rid of the horizontal tab bar to save vertical space and reduce confusion, edit userChrome.css
to add this:
/* Hide tab bar in FF Quantum */
@-moz-document url("chrome://browser/content/browser.xul") {
If you're generating your website with Jekyll or another static website generator, don't forget to also expose a web feed for us old timer using RSS readers. The format we'll be preferring here is Atom.
Some reasons to expose a web feed:
- people using RSS readers regularly are pretty loyal, RSS/Atom subscribers being like a mailing list for some of us
- tooling knows RSS/Atom — e.g. the easiest way to build a mailing list is to give Mailchimp your RSS feed
If you're looking for a recommendation on online RSS readers, I personally like Newsblur.
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
import java.io.{File, FileInputStream, FileOutputStream} | |
import monix.eval.Task | |
import monix.execution.Ack | |
import monix.execution.Ack.{Continue, Stop} | |
import monix.reactive.{Consumer, Observable, Observer} | |
import scala.util.control.NonFatal | |
def copyFile(input: File, destination: File, chunkSize: Int): Task[Unit] = | |
Task.defer { | |
val in = new FileInputStream(input) |
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
import concurrent.{Future, Await, Promise, ExecutionContext} | |
import java.util.concurrent.{Future => JavaFuture, TimeUnit, Callable, CancellationException, ExecutorService} | |
import concurrent.duration._ | |
import scala.util.Success | |
import scala.util.Failure | |
import scala.util.control.NonFatal | |
import scala.collection.JavaConverters._ | |
import concurrent.duration.TimeUnit | |
import java.{util => jutil} |
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
#!/usr/bin/env node | |
import { IO, Try, Success, Failure, Either, Left, Right, Cancelable, Duration } from "funfix" | |
import { RequestResponse } from "request" | |
import * as fs from "fs" | |
import * as request from "request" | |
import * as Url from "url" | |
import * as cheerio from "cheerio" | |
import * as minimist from "minimist" |
To configure this script to automatically execute on file changes, save the XML config in ~/Library/LaunchAgents/dot-files.sync.plist
then do:
launchctl load -w ~/Library/LaunchAgents/dot-files.sync.plist
NewerOlder