|
bash
Create Resized and Renamed Non-Retina Images with Sed & ImageMagick »
|
ls | sed -n 's/\(.*\)\(@2x\)\(.*\)/convert "\1\2\3" -resize 50% "\1\3"/p' | sh |
|
Linux
Copy Matching Files in All Subfolders to Target (Flatten) »
|
find . -iname *.png -print | xargs -I file cp file ./ |
|
Python
Recurse up from the current working directory until a file is found »
|
newpath = os.getcwd()
path = ''
while "fabfile.py" not in os.listdir(newpath) and path != newpath:
path = newpath
print path
os.chdir('../')
newpath = os.getcwd()
if path == newpath:
exit("WARNING: NO FAB FILE FOUND")
|
|
iOS
Concatenate multiple path components safely »
|
NSString *path1 = @"/Volumes/Path/to.something/";
NSString *path2 = @"/special";
NSString *filename = @"afile.txt";
NSString *all = [[path1 stringByAppendingPathComponent:path2] stringByAppendingPathComponent:filename];
|
|
iOS
Get the folder part of a full path filename »
|
NSString *file = @"/Volumes/Path/to.something/my/file.bundle";
NSString *folder = [file stringByDeletingLastPathComponent]; |
|
Python
Python Equivalent of PHP’s Magic Constant __FILE__ »
See the important note on Stack Overflow....
|
os.path.dirname(os.path.abspath(__file__)) |