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
find ./app -type f -not -path './db/*' -iregex '.*.\(rb\|haml\|erb\)' -exec sed -ri 's/\.length([^_])/\.size\1/g' {} \; |
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
find . -type f -not -path './db/*' -iregex '.*.\(rb\|haml\|erb\)' -exec sed -ri 's/(\.count)/\.size/g' {} \; |
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
# .try :method -> &.method | |
find ./ -type f -exec sed -ri 's/(.try\s*:)/\&./g' {} \; | |
# .try(:method) -> &.method | |
find ./ -type f -exec sed -ri 's/(.try\(?:)([^),]*)(\))/\&.\2/g' {} \; |
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/sh | |
# Start mysql if its not running | |
mysql_daemon='mysqld' | |
pgrep='/usr/bin/pgrep' | |
$pgrep $mysql_daemon > /dev/null | |
if [ $? -ne 0 ]; then | |
sudo /usr/sbin/service mysql start | |
fi |
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/sh | |
# First create /etc/wsl.conf as sudo if it doesn't exist. Then add the following lines and restart wsl. | |
# [network] | |
# generateResolvConf = false | |
# Next run `sudo rm /etc/resolv.conf` then execute this script. | |
# Finally run `sudo ln -s $HOME/.resolv.conf /etc/resolv.conf` | |
nameservers=$(powershell.exe -Command "Get-DnsClientServerAddress -AddressFamily ipv4 | Select-Object -ExpandProperty ServerAddresses") | |
echo -e nameserver $nameservers | sed -z 's/\r/\nnameserver/g' | head -n -1 > $HOME/.resolv.conf |
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/sh | |
echo -e "\033[0;31mRunning parallel:spec recursively until a failure occurs\033[0m" | |
: > rspec_error.txt #clear file in case last run failed | |
pushd $1 | |
while [[ $(tail -n 1 ~/rspec_error.txt) != "Tests Failed" ]] | |
do | |
rake parallel:spec 1>~/rspec_out.txt 2>~/rspec_error.txt | |
echo -ne "\033[1;34m.\033[0m" | |
done |