1.Make a copy of the .xib in the Finder.
2. Open the copied file in a text editor.
3. Change “com.apple.InterfaceBuilder3.CocoaTouch.XIB” to “com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB”.
4. Change all instances of “IBCocoaTouchFramework” to “IBIPadFramework”.
5. Search for sizes like {480, 320} and edit them. Or just reopen the file in Xcode and use the GUI to resize items as needed.
Posted in
Ruby on Rails at November 17th, 2011.
No Comments.
Add this to your {App}-prefix.pch file
#ifndef __OPTIMIZE__
# define NSLog(…) NSLog(__VA_ARGS__)
#else
# define NSLog(…) {}
#endif
__OPTIMIZE__ only be set on release of build your app.
Posted in
IPhone,
xcode at August 8th, 2011.
No Comments.
Quit Safari
Open the Terminal
Move the folder ~/Library/Safari into your Dropbox
mv ~/Library/Safari ~/Dropbox
Make a link from the old location to the new location (for your Mac’s safari to use).
ln -s ~/Dropbox/Safari/ ~/Library/Safari
You’re done on your mac!
Posted in
Script at August 2nd, 2011.
No Comments.
before you run this script, you should had ruby env and Xcode.
1. save it with name ‘png’
2. chmod +x png
useage: ./png [ipa file path]
#!/usr/bin/env ruby -wKU
require 'rubygems'
ipa = ARGV.first
puts "useage:png " and return if !ipa or ipa.end_with?("ipa")
name = File.basename(ipa, ".ipa")
# create output folder in you desktop
output = "#{ENV['HOME']}/Desktop/#{name}"
system %Q{mkdir -p "#{output}" && unzip "#{ipa}" -u -d "#{output}"}
Dir.glob(File.join(output, "**", "*.png")).each do |f|
system %Q{/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations -q "#{f}" "#{File.join(output ,File.basename(f))}"}
end
system %Q{find '#{output}' -type f -not \\( -iname "*.png" -or -iname "*.jpg" -or -iname "*.jpeg" \\) -delete}
system %Q{open "#{output}" -a finder}
Posted in
IPhone,
Script at July 31st, 2011.
No Comments.
May be there is another better method to do this. If you have the better way to do it, please tell me.
BTW, below code were successful running in rails3 and ruby 1.8.7
1. first, you should add open4 gem to your Rails project Gemfile
gem 'open4'
and run “bundle install” in terminal to install it in project dir.
2. add below code to config/deploy.rb, please change the namespace name to your own
namespace :your_namespance_name do
require 'open4'
rails_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
stdin, stdout, stderr = Open4::popen4("cd #{rails_root} && rake -T")
#please replace :your_namespance_name to your own, this code to grap you special of namespance rake tasks
stderr.read.scan(/your_namespance_name\:(\w+)/).each do |match|
desc "rake task named '#{match.last}'"
task match.last.to_sym, :roles => :app do
run "cd #{current_path}; RAILS_ENV=production rake railscasts:#{match}"
end
end
end
after do that, when you run cap -T in you command shell, you will be found the tasks from rake, also, it can invoked from the remote server of you own.
Posted in
Ruby on Rails,
Script at January 18th, 2011.
1 Comment.
CALayer *touchedLayer = [self.view layer];
// here is an example wiggle
CABasicAnimation *wiggle = [CABasicAnimation animationWithKeyPath:@"transform"];
wiggle.duration = 0.1;
wiggle.repeatCount = 1e100f;
wiggle.autoreverses = YES;
wiggle.toValue = [NSValue valueWithCATransform3D:CATransform3DRotate(touchedLayer.transform,0.1, 0.0 ,1.0 ,2.0)];
// doing the wiggle
// [touchedLayer addAnimation:wiggle forKey:@"wiggle"];
Posted in
IPhone at January 4th, 2011.
3 Comments.
put this to you ~/.inputrc
# do not show hidden files in the list
set match-hidden-files off
# auto complete ignoring case
set show-all-if-ambiguous on
set completion-ignore-case on
# lookup in search histories
"\ep": history-search-backward
"\e[A": history-search-backward
"\e[B": history-search-forward
Posted in
Script at December 23rd, 2010.
3 Comments.
wget -m -erobots=off -U Mozilla -p <web site url>
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains your.website.com \
--no-parent \
http://your.website.com/
Posted in
Script at October 22nd, 2010.
No Comments.
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
Posted in
Ruby on Rails at September 15th, 2010.
2 Comments.
!.*/(\.[^/]*|vendor/rails|doc|rails_root|CVS|log|data_dump|build|_darcs|pkg |_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)? |bundle|vendor/.*/test))$
Posted in
Script at September 1st, 2010.
1 Comment.