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 com.rtfpessoa.scala | |
import scala.language.postfixOps | |
import scala.util.Properties | |
case class LittleTree(height: Int) { | |
implicit class IntOps(int: Int) { | |
def isOdd = int % 2 > 0 | |
} |
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 | |
# | |
# Remove RUNNING_PID on PlayFramework applications | |
# | |
for DOCKER in $(docker ps -a -q --filter "name=codacy_"); do | |
docker stop $DOCKER | |
docker start $DOCKER | |
docker exec -it $DOCKER rm RUNNING_PID |
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 NameReDef { | |
def withWrapper(foo: String => String) = { | |
println("Wrapping ...") | |
foo("My pretty string") | |
} | |
def bar = { | |
withWrapper { str => | |
// Does not compile if we use the str above before the re-definition | |
// println("Defined:") |
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 | |
EXTENSION=$1 | |
FILE_COUNT=0 | |
LINE_SUM=0 | |
for FILE in $(find . -type f -iname "*.$EXTENSION") | |
do | |
NUM_LINES=$(cat $FILE | wc -l) | |
NUM_LINES=${NUM_LINES%% } |
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.zip.{ZipEntry, ZipFile, ZipOutputStream} | |
import better.files._ | |
import scala.collection.JavaConversions.enumerationAsScalaIterator | |
import scala.language.existentials | |
import scala.util.{Properties, Try} | |
object ZipUtils { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBlackColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEB8w | |
LjAzMTM3MjU0OTAyIDAuMTYwNzg0MzEzNyAwLjIAEAGAAtIQERITWiRjbGFzc25hbWVY | |
JGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRy |
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 | |
DOCKER_TIMEOUT=$1 | |
shift | |
CONTAINER=$(docker run -d "$@") | |
docker stop --time=900 $CONTAINER | |
EXIT_CODE=$(docker wait $CONTAINER) |
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
brew update | |
brew versions FORMULA | |
cd `brew --prefix` | |
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions" | |
brew install FORMULA | |
brew switch FORMULA VERSION | |
git checkout -- Library/Formula/FORMULA.rb # reset formula | |
## Example: Using Subversion 1.6.17 | |
# |
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 | |
# MacTeX uninstaller script based on pkgutil command | |
# by Akihiro Uchida, CC0 dedicated to the public domain | |
# see http://creativecommons.org/publicdomain/zero/1.0/ | |
IFS=$(echo -en "\n") | |
for pkg in $(pkgutil --pkgs|grep org.tug.mactex); do | |
volume="$(pkgutil --pkg-info "$pkg"|grep volume|cut -d' ' -f2-)" | |
location="$(pkgutil --pkg-info "$pkg"|grep location|cut -d' ' -f2-)" | |
echo "remove all of the files installed under the $pkg" | |
for file in $(pkgutil --files "$pkg"); do |
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
# | |
# Sets Prezto options. | |
# | |
# Authors: | |
# Sorin Ionescu <sorin.ionescu@gmail.com> | |
# | |
# | |
# General | |
# |