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
// taken from http://www.playframework.org/documentation/api/2.0/scala/play/api/libs/json/package.html | |
case class User(id: Long, name: String, friends: List[User]) | |
implicit object UserFormat extends Format[User] { | |
def reads(json: JsValue): User = User( | |
(json \ "id").as[Long], | |
(json \ "name").as[String], | |
(json \ "friends").asOpt[List[User]].getOrElse(List())) | |
def writes(u: User): JsValue = JsObject(List( |
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 | |
{ | |
import com.wordnik.api.batch.*; | |
import com.wordnik.api.client.*; | |
import com.wordnik.api.entity.*; | |
import com.wordnik.api.entity.word.*; | |
import com.wordnik.api.event.*; | |
import flash.display.Sprite; | |
import flash.text.TextField; |
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 FontsList { | |
val fonts = Array( | |
"./apache/aclonica/METADATA.json", | |
"./apache/calligraffitti/METADATA.json", | |
"./apache/cherrycreamsoda/METADATA.json", | |
"./apache/chewy/METADATA.json", | |
"./apache/comingsoon/METADATA.json", | |
"./apache/craftygirls/METADATA.json", | |
"./apache/creepstercaps/METADATA.json", | |
"./apache/crushed/METADATA.json", |
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
{ | |
"Handwriting": [ | |
"Calligraffitti", | |
"Coming Soon", | |
"Crafty Girls", | |
"Homemade Apple", | |
"Just Another Hand", | |
"Montez", | |
"Permanent Marker", | |
"Rancho", |
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
$ free -g | |
total used free shared buffers cached | |
Mem: 7 4 2 0 0 2 | |
-/+ buffers/cache: 1 5 | |
Swap: 0 0 0 | |
$ free -m | |
total used free shared buffers cached | |
Mem: 7454 4450 3004 0 168 2695 | |
-/+ buffers/cache: 1586 5868 |
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
# source: | |
# http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/proc.txt#n800 | |
# | |
# MemTotal: Total usable ram (i.e. physical ram minus a few reserved | |
# bits and the kernel binary code) | |
# MemFree: The sum of LowFree+HighFree | |
# MemAvailable: An estimate of how much memory is available for starting new | |
# applications, without swapping. Calculated from MemFree, | |
# SReclaimable, the size of the file LRU lists, and the low | |
# watermarks in each zone. |
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
while true; do | |
date; echo; | |
ps aux | awk '{print $2, $4, $11}' | sort -k2r | head -n 5; echo; | |
free -m; echo; | |
cat /proc/meminfo | egrep '(Slab|SRec|SUnr)'; echo; | |
cat /proc/$(pidof $1)/status | grep Vm; | |
echo; echo '_____________________'; echo; | |
cat /proc/sys/fs/file-nr; echo; | |
sudo lsof -c $1 | wc -l; echo; | |
sudo lsof -i -c $1 | grep CLOSE_WAIT | wc -l; echo; |
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
# Install cucumber & protractor | |
echo \\nInstalling Components... | |
npm install -g cucumber protractor | |
# Download and install selenium webdrivers | |
echo \\nInstalling selenium webdrivers... | |
webdriver-manager update | |
# TODO: Run Server |
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
https://news.ycombinator.com/item?id=9764564 | |
US 108 | |
Canada 42 | |
America 42 | |
U.S. 25 | |
Zealand 20 | |
Europe 18 | |
NZ 17 | |
Japan 16 |
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 PrettyTimeParser { | |
private val YEAR_REGEX = """(?<YEAR>\d+)\s*years?""".r | |
private val MONTH_REGEX = """(?<MONTH>\d+)\s*months?""".r | |
private val WEEK_REGEX = """(?<WEEK>\d+)\s*weeks?""".r | |
private val DAY_REGEX = """(?<DAY>\d+)\s*days?""".r | |
private val HOUR_REGEX = """(?<HOUR>\d+)\s*hours?""".r | |
private val MINUTE_REGEX = """(?<MINUTE>\d+)\s*minutes?""".r | |
private def lookup(regex: scala.util.matching.Regex, s: String): Int = { | |
Try(regex.findAllIn(s).toList.headOption.map(_.split(" ")).map(_(0).toInt)).getOrElse(None).getOrElse(0) |
OlderNewer