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 Resources/Localizable.strings -name "*.strings" -type f -exec gsed -i 's/\\\\\"%@\\\\\"/\\\"%@\\\"/g' {} ";" -exec plutil -lint {} ";" | |
# needs gnu-sed to be installed for -i parameter |
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
Dir.foreach("/usr/local/Cellar/cowsay/3.03/share/cows") {|cow| puts cow; system "fortune | cowsay -f /usr/local/Cellar/cowsay/3.03/share/cows/#{cow}" } |
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
data Fizzbuzz = FizzBuzz | |
| Fizz | |
| Buzz | |
deriving Show | |
fizzbuzz :: [Integer] -> String | |
fizzbuzz x = unlines (map fizzbuzzline x) | |
fizzbuzzline :: Integer -> String | |
fizzbuzzline x = fizzBuzzToString x (fizzBuzzFromNum x) |
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
#!/usr/bin/env ruby | |
ARGV.each do|a| | |
puts "#{a}".split("").shuffle.join | |
end |
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 <Foundation/Foundation.h> | |
NSMutableArray* fizzbuzzreplace(NSMutableArray* numberArray, NSUInteger divider, NSString* replacementString) | |
{ | |
for (NSUInteger i = divider; i < numberArray.count + 1; i = i + divider) { | |
[numberArray replaceObjectAtIndex:i - 1 withObject:replacementString]; | |
} | |
return numberArray; | |
} |
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 "searching for updates..." | |
brewoutput=`brew update` | |
if [ "$brewoutput" == "Already up-to-date." ] | |
then | |
echo "nothing to update" | |
else | |
echo "updating..." | |
brewoutput=`brew upgrade --all` | |
if [[ "$brewoutput" == *".app bundles were installed."* ]] |
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
# replace mate with editor of your choice | |
alias releasenotes="git log --oneline --no-merges `git describe --abbrev=0 --tags`..HEAD | cut -c 9- | sort | mate" |
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
# StackView Tips | |
## Performance hack | |
### Old hack | |
Use a UITableViewCell's contentview. The layout will not bubble up from here. Keeps all layout restriced to that view. | |
Then set frame of cell. | |
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
# run with | |
# ruby reallyCleanXcode.rb | |
derivedDataFolder = Dir.glob(Dir.home + "/Library/Developer/Xcode/DerivedData/*") | |
moduleCache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*") | |
FileUtils.rm_rf derivedDataFolder + moduleCache | |
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
// MissingInteger | |
// Find the smallest positive integer that does not occur in a given sequence. | |
//This is a demo task. | |
// | |
//Write a function: | |
// | |
//public func solution(_ A : inout [Int]) -> Int | |
// | |
//that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A. |
OlderNewer