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
class A | |
cattr_reader( | |
:dictionary | |
) | |
@@dictionary = {} | |
end | |
class B < A |
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
# gem 'xcodeproj' | |
# native_target.rb | |
# @return [String] the name of the build product. | |
# | |
attribute :product_name, String | |
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
class A | |
def needToCallAsInstanceAndClass# or no arguments | |
self.class.needToCallAsInstanceAndClass(self.getArgs) | |
end | |
def self.needToCallAsInstanceAndClass(*args) | |
# wowowow | |
# implementation here | |
end | |
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
class A | |
def relativePath(path) | |
self.relativePath(path,self.path) | |
end | |
def self.relativePath(path,to_path) | |
Pathname.new(path).relative_path_from(Pathname.new(to_path)) | |
end | |
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
ls ./AppIcon.appiconset/*.png | perl -MFile::Basename -ne 'chomp; ($b, $d, $f) = fileparse($_, qr/\.[^.]*/); $s = qx(convert -channel G -separate ${_} ./AppIconPublicBeta.appiconset/${b}.png); print "$s"; print "\n";' | |
http://www.imagemagick.org/Usage/color_basics/#separate |
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 ./AirkeyObjC -name '*.xcworkspace' | grep -v 'xcworkspace/' | grep -v 'xcodeproj' | perl -ln -MFile::Spec -MFile::Basename -e 'chomp; $old = $_; $_ = basename($_); $old = File::Spec->rel2abs($old); $new = File::Spec->rel2abs(qq(./AirkeyObjCProjects/$_)); $t = qx(ln -s $old $new); print $t;' | |
use File::Spec; | |
use File::Basename; | |
sub findInDirectory { | |
my $directory = shift; | |
[qx(find ./$directory -name '*.xcworkspace' | grep -v 'xcworkspace/' | grep -v 'xcodeproj')]; | |
} | |
sub copyProjects { |
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
# $file = path to file; | |
# $name = ( name to search (actually, it is a regex) ) | |
# EncryptedCoreData: | |
# - :commit: 5044489e622143d6efdb69fbbc383748618b5fe4 | |
# + :commit: 4ca0977e9e0b610e6813886276bb7bbd9406335f | |
# | |
# | |
# Pod revision. | |
git log -p -- FILE | perl -lne '$name = 'PODNAM'; (/^\s+$name[\w-]*:\s*$/ .. /^\+\s+:commit:/) and print' |
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
/* | |
For example, you use Core Data sqlite. | |
It is necessary, because sqlite database stores data in single file. | |
Whole database is single file. | |
Now you have two options. | |
1. Delete all data from all tables | |
2. Delete database sqlite file | |
Second option is clean but complex. |
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
ls Resources/*.png | perl -lne '$old = $_; s/(\@\w+)/_inverted$1/; $_ = qx(basename $_); chomp; $_ = qq(Results/$_); $s = qq(convert $old -fuzz 10% -fill none +opaque white $_); print $s; print qx($s);' | |
# 1. details: | |
# 2. take png images from directory Resources | |
# 3. append "_inverted" before \@ symbol. | |
# 4. convert $old -fuzz 10% -fill none +opaque white $new | |
# 5. -fuzz add threshold in 10% for white color. Which are NOT white in 10% thresholds would be removed. | |
# 6. -fill none should fill color with transparent color | |
# 7. +opaque matches color to be replaced. plus add inversion. So, +opaque matches these colors that SHOULD NOT be replaced. |