Skip to content

Instantly share code, notes, and snippets.

View vackosar's full-sized avatar
🛰️

Vaclav Kosar vackosar

🛰️
View GitHub Profile
@davidreuss
davidreuss / useful bashisms
Created July 10, 2009 11:46
useful bashisms
#!/bin/bash
# Default variable if not set
[ -z "${var:-}" ] && var="Default..."
echo "$var"
# array declaration
@ryanlecompte
ryanlecompte / gist:5210745
Last active August 25, 2021 13:40
mutable.ArrayBuffer vs immutable.Vector
import scala.collection._
import com.twitter.util._
scala> val buffer = mutable.ArrayBuffer.empty[Int]
scala> println(Time.measure { (0 to 50000000).foreach { buffer += _ } }.inMillis)
17610
scala> var vector = immutable.Vector.empty[Int]
scala> println(Time.measure { (0 to 50000000).foreach { vector :+= _ } }.inMillis)
7865
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.