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
# -*- coding: utf-8 -*- | |
import optparse | |
import xml.etree.ElementTree as ET | |
targets = ['button', 'label', 'textField'] | |
def main(storyboard): | |
tree = ET.parse(storyboard) | |
for target in targets: | |
for element in tree.getroot().iter(target): |
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 func viewController() -> UIViewController { | |
let vc = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle()).instantiateViewControllerWithIdentifier("ViewController") as UIViewController | |
return vc | |
} |
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
let textAttributes = [ | |
NSFontAttributeName: UIFont(name: "FontAwesome", size: 18), | |
NSForegroundColorAttributeName: UIColor.redColor() | |
] | |
let rightBarButtonItem = UIBarButtonItem(title: "Search", style: .Plain, target: nil, action: nil) | |
rightBarButtonItem.setTitleTextAttributes(textAttributes, forState: .Normal) | |
rightBarButtonItem.title = NSString.awesomeIcon(FaSearch) | |
self.navigationItem.rightBarButtonItem = rightBarButtonItem |
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
func applyBlur(view: UIView) { | |
var visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light)) as UIVisualEffectView | |
visualEffectView.frame = view.bounds | |
view.addSubview(visualEffectView) | |
} |
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 re | |
import sys | |
import optparse | |
def main(color): | |
print "R:%d G:%d B:%d" % tuple([int(x, 16) for x in re.findall('[a-fA-F0-9]{2}', color[1:] if color[0] == '#' else color)]) | |
if __name__ == '__main__': | |
usage = "Usage: %prog code" |
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 python | |
import re | |
import sys | |
import optparse | |
def main(color): | |
print "[UIColor colorWithRed:%.3f green:%.3f blue:%.3f alpha:1.f]" % tuple([round(int(x, 16) / 255., 3) for x in re.findall('[a-fA-F0-9]{2}', color[1:] if color[0] == '#' else color)]) | |
if __name__ == '__main__': | |
usage = "Usage: %prog code" |
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
box: wercker/nodejs | |
# Build definition | |
build: | |
# The steps that will be executed on build | |
steps: | |
# A step that executes `npm install` command | |
- npm-install | |
# A step that executes `npm test` command | |
#- npm-test | |
- add-to-known_hosts: |
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
# xib -> strings | |
ibtool --generate-strings-file en.lproj/HogeViewController.strings en.lproj/HogeViewController.xib | |
# strings -> xib | |
ibtool --strings-file ja.lproj/HogeViewController.strings en.lproj/HogeViewController.xib --write ja.lproj/HogeViewController.xib |
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 ./ -name "*.m" | xargs cat | python -c "import sys,re;print('\n'.join([s for s in re.compile(r'@\"([^\"]+)\"').findall(sys.stdin.read()) if re.search(r'[^\x01-\x7E]', s)]))" |
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
# -*- coding: utf-8 -*- | |
import sys | |
import time | |
import argparse | |
from daemon import DaemonContext | |
from daemon.pidfile import PIDLockFile | |
def daemon_loop(interval=600): |
NewerOlder