View terminology.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:826504
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
// Clone just one branch | |
mkdir $BRANCH | |
cd $BRANCH | |
git init | |
git remote add -t $BRANCH -f origin $REMOTE_REPO | |
git checkout $BRANCH | |
// Aliases and stuff | |
git config --global user.name "Luis Uribe" |
View sbtmkdirs.sh
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
#!/bin/bash | |
#------------------------------------------------------------------------------ | |
# Name: sbtmkdirs | |
# Version: 1.5 | |
# Purpose: Create an SBT project directory structure with a few simple options. | |
# Author: Alvin Alexander, http://alvinalexander.com | |
# License: Creative Commons Attribution-ShareAlike 2.5 Generic | |
# http://creativecommons.org/licenses/by-sa/2.5/ | |
#------------------------------------------------------------------------------ |
View TxMapTest.scala
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.util.concurrent.atomic.AtomicReference | |
import java.util.concurrent.CountDownLatch | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext | |
import ExecutionContext.Implicits.global | |
object TxMapTest { | |
/* | |
* Example Usage | |
* We want to show two threads working with the same data source having both of their effects succeed |
View EnvHacker.scala
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 EnvHacker { | |
/** | |
* Portable method for setting env vars on both *nix and Windows. | |
* @see http://stackoverflow.com/a/7201825/293064 | |
*/ | |
def setEnv(newEnv: Map[String, String]): Unit = { | |
try { | |
val processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment") | |
val theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment") | |
theEnvironmentField.setAccessible(true) |
View lunar.rs
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
//! Translation of | |
//! <http://www.cs.brandeis.edu/~storer/LunarLander/LunarLander/LunarLanderListing.jpg> | |
//! by Jim Storer from FOCAL to Rust. | |
use std::error::Error; | |
use std::io; | |
use std::io::prelude::*; | |
use std::marker::{Send, Sync}; | |
use std::process; | |
use std::str::FromStr; |
View HexBytesUtil.scala
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
object HexBytesUtil { | |
def hex2bytes(hex: String): Array[Byte] = { | |
hex.replaceAll("[^0-9A-Fa-f]", "").sliding(2, 2).toArray.map(Integer.parseInt(_, 16).toByte) | |
} | |
def bytes2hex(bytes: Array[Byte], sep: Option[String] = None): String = { | |
sep match { | |
case None => bytes.map("%02x".format(_)).mkString | |
case _ => bytes.map("%02x".format(_)).mkString(sep.get) |
View config.scala
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 scalaz.example | |
object Reader extends App { | |
/** | |
* Manual propagation of the environment (in the example, `contextRoot`.) | |
*/ | |
object Config0 { | |
def fragment1(contextRoot: String) = <a href={contextRoot + "/foo"}>foo</a> |
View LinVect.scala
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
object LinVect { | |
type K = Double | |
trait NAT[N] { val nat: Int } | |
def NAT[N: NAT]: NAT[N] = implicitly | |
def nat[N: NAT]: Int = NAT[N].nat | |
trait NAT_10 | |
implicit object NAT_10 extends NAT[NAT_10] |
NewerOlder