|
|
Cmd+,
open Settings
.Packages
and open settings of node-debugger
.Node Path
and Script Main
.node-debugger:start-resume
.node-debugger:toggle-breakpoint
to toggle breakpoint where you want.node-debugger:step-next
,node-debugger:start-resume
and node-debugger:stop
for debug.A tool to enforce Swift style and conventions, loosely based on GitHub’s Swift Style Guide .
|
|
插件自动在保存文件时运行 swiftlint
SwiftLintXcode
|
|
git commit
时自动格式化加入stage的代码
pre-commit.sh
文件
|
|
|
|
|
|
swiftlint rules
查看所有规则swiftlint rules rule_name
查看规则详情在git仓库根目录新建文件 .swiftlint.yml
作用于整个项目
官方sample
|
|
|
|
|
|
|
|
|
|
if
|
|
then
|
|
endif
Control and manage Android devices from your browser.
ADB hasn’t whitelisted the manufacturer’s vendor ID
mac OSX上eclipse adb无法识别(调试)小米的解决方案
|
|
|
|
Solution
|
|
Can’t connect Nexus 4 to adb: unauthorized Vasudev’s answer
Revoke USB debugging authorities
|
|
How to edit the init.rc in android 不敢尝试,感觉风险很大
]]>14,如何备份虚拟系统?如果我要转移到更大的SD卡上又要怎么做?
以GW为例, 简单的,只要三步(前提是第一个虚拟系统是由GW制作的,虚拟系统头部信息是GW样式,下面那个emuNANDtool工具才能用):
4G卡连电脑,用emuNANDtool备份4G卡中的虚拟系统到电脑上(Extract emuNAND按钮,文件名默认是emunand.bin);
8G卡连电脑,把GW固件Launcher.dat拷到卡根目录,放回3ds里,按住L键点击“DS用设定”进GW菜单,执行FORMAT EMUNAND,格式化完成后长按电源按钮关机
;
8G卡再连电脑,用emuNANDtool将刚才备份的恢复到8G卡上(Inject NAND to emuNAND),待进度条100%后(注意,别急着去试虚拟系统),先将4G卡里的所有文档拷到8G卡上,就是Nintendo等文件夹还有*.sav那些存档文件,再插回机器里启动虚拟系统。(未拷入Nintendo 3DS文件夹前,别先运行新SD卡上的虚拟系统,不然有可能不认之前的旧卡的内容
)
OK,搬运完成。 emuNANDtool下载地址:
旧版仅支持旧版3DS的GW虚拟系统 emuNANDTool_1.0.1.zip
http://buildbot.libretro.com/nightly/nintendo/3ds/
Select
load 3DS gameSaveDataFiler
if (CTR card
is broken then)
SELECT
键加载 3DS/3DZ,之后打开 SaveDataFiler
,在 User
栏目中,找到 CTR card
,按 Y
导出存档SD
栏目中,找到你刚导出的存档,按R+A
键导入存档至 CIA (**)else
User
column select CTR card
press Y
SD
column select latest row press R+A
end if
目标全ROM制霸,3DS、CIA双格式分享,已完成0001-1200(除1162、1177)
[DLC] 【全套34DLC】【日版】0976-太鼓达人 咚咔的时空大冒险 日版 V150605
game | save |
---|---|
巨人战争2 | 0004000000144400 |
太鼓达人咚咔的时空大冒险 | 0004000000102F00 |
|
|
|
|
|
|
加速pull
|
|
ngrok.com
has been GFWed
ngrok.zip
|
|
output will be like
|
|
http://c9f486b5.ngrok.io
also GFWed
|
|
output will be like
|
|
ssh login
|
|
TUNNEL是一个基于NGROK的免费
网络服务
|
|
|
|
|
|
For 32bit
machine
|
|
Add this line on your .bashrc
|
|
|
|
Error
|
|
|
|
Replace /usr/local/src/ngrok/src/ngrok/log/logger.go
line 5 with
|
|
|
|
Edit config.cfg
|
|
|
|
|
|
Error on server log
|
|
Self Hosted ngrokd fails to allow client to connect
Solution
|
|
|
|
add line before exit
|
|
|
|
|
|
_config.yml
|
|
#修改模版,生成 Tags 和 About 等
scaffolds/post.md
|
|
|
|
source/tags/index.md
source/categories/index.md
|
|
新增文件 themes/next/layout/_scripts/analytics/getclicky-analytics.swig
|
|
编辑 themes/next/layout/_scripts/analytics.swig
|
|
直接使用 hexo-deployer-git 发布会出现覆盖commit 的问题
源码如下 node_modules/hexo-deployer-git/lib/deployer.js
|
|
|
|
resources
必须放到 public
文件夹
缺点:必须使用两个 repo ,发布麻烦
编辑 .gitignore
|
|
hexo n 文件没有修改权限
|
|
Tools
-> Build System
-> New Build System...
|
|
|
|
Nice
]]>Alfred v2.8
21st Sep 2015
•JavaScript is now available as a scripting language within Alfred Workflows (OS X 10.10+, using osascript)
Follow these steps for each computer whose screen you want to share.
OpenEmu Experimental
from http://openemu.org/ and unzip itbios
from http://www.theisozone.com/downloads/playstation/other/sony-playstation-bios-package/ and unzip itOpenEmu
drag SCPH5500.BIN
and SCPH5502.BIN
into OpenEmu
SCPH5552.bin
to SCPH5501.bin
and drag it into OpenEmu
http://mednafen.fobby.net/documentation/psx.html
Filename | MD5 |
---|---|
scph5500.bin | 8dd7d5296a650fac7319bce665a6a53c |
scph5501.bin | 490f666e1afb15b7362b406ed1cea246 |
scph5502.bin | 32736f17079d0b2b7024407c39bd3050 |
##Copy following lines into ~/.bashrc
or ~/.zshrc
|
|
##Make sure ~/bash_profile
contains following line
#Usage
|
|
##Solution
|
|
|
|
|
|
then copy
|
|
into ~/.proxychains/proxychains.conf
##usage
|
|
In order to do this in Yosemite, you’ll need to go back to the main screen of System Preferences and click on the Sharing
preference pane. In the sidebar, there will be an Internet Sharing option. Click on this to view its settings.
Now set the “Share your connection from” drop down to Wi-Fi
and then check the Bluetooth PAN
checkbox in the menu below. Next just make sure to check the box next Internet Sharing in the sidebar.
Once this is done your Mac should be sharing its Wi-Fi connection to devices in your Bluetooth PAN.
]]>
|
|
|
|
www.mysite.com 可以是ip
mycert1.cer
mycert1.key
创建https服务myCA.cer
|
|
|
|
Combine two signals
|
|
777
]]>4、将libReveal.dylib上传到设备的/Library/MobileSubstrate/DynamicLibraries
6、re-spring或重启iOS设备,打开你想看的app,再从Reveal界面左上角选择要连接的机器,进入不同的页面之后还可以点击右上角的刷新钮来刷新监测的页面信息。
这步我的iphone 就无限 apple logo 了,
差点就用 itunes restore 了
幸好看到了这个哥们的视频
解决的了无限logo
方法就是按住音量上30秒或以上
但是启动了手机之后所有cydia 插件都不能用了, 超雪
afc2add
都没的了,多半是 libReveal.dylib 把cydia 的auto load 卡到了,
ifunbox 也不能打开 iphone 的root file system,
不过openssh
还可以用, 用ssh
到手机果断 rm /Library/MobileSubstrate/DynamicLibraries/libReveal.dylib
重启手机完全正常.
reveal crisis
fin
#解决办法
Reveal 1.5.x 會讓 SpringBoard crash
正確解法是新增 libReveal.plist 設定 filter (對,我以前懶惰都不設定)
Bundle 設定一個不存在的值就好了,例如 com.apple.Tabemonodesuyo
之後裝 Reveal Loader,用 loader 去控制要在哪個 App 執行就好,
Injecting Reveal With MobileSubstrate
|
|
|
|
How To Run Meld on Mac OS X Yosemite Without Homebrew, MacPorts, or Think
|
|
|
|
UIViewControllerBasedStatusBarAppearance
to YES
in the .plist
file.viewDidLoad
do a [self setNeedsStatusBarAppearanceUpdate];
|
|
This will not work controllers inside UINavigationController
For anyone using a UINavigationController:
The UINavigationController
does not forward on preferredStatusBarStyle
calls to its child view controllers. Instead it manages its own state - as it should, it is drawing at the top of the screen where the status bar lives and so should be responsible for it. Therefor implementing preferredStatusBarStyle in your VCs within a nav controller will do nothing - they will never be called.
The trick is what the UINavigationController
uses to decide what to return for UIStatusBarStyleDefault
or UIStatusBarStyleLightContent
. It bases this on it’s UINavigationBar.barStyle
. The default (UIBarStyleDefault
) results in the dark foreground UIStatusBarStyleDefault
status bar. And UIBarStyleBlack
will give a UIStatusBarStyleLightContent
status bar.
If you want UIStatusBarStyleLightContent
on a UINavigationController
use:
|
|
In 1x place image with resolution 320 x 480.
In 2x place image with resolution 640 x 960.
In Retina 4 2x place image with resolution 640 x 1136.
in 3x place image with resolution 1242 x 2208.
Images of Retina 4 2x will upscale to resolution 750 x 1334.
Images 3x will downscale to resolution 1080 x 1920.
http://stackoverflow.com/questions/26020979/xcode-6-xcassets-for-universal-image-support
##Size Class for launch image
2x [- +]
for iPhone62x [- +]
for iPhone43x [- +]
for iPhone6plusRetina 4 2x [- +]
for iPhone5
|
|
#logical
表达式 | 逻辑 |
---|---|
str1 = str2 | 当两个串有相同内容、长度时为真 |
str1 != str2 | 当串str1和str2不等时为真 |
-n str1 | 当串的长度大于0时为真(串非空) |
-z str1 | 当串的长度为0时为真(空串) |
str1 | 当串str1为非空时为真 |
表达式 | 逻辑 |
---|---|
int1 -eq int2 | 两数相等为真 |
int1 -ne int2 | 两数不等为真 |
int1 -gt int2 | int1大于int2为真 |
int1 -ge int2 | int1大于等于int2为真 |
int1 -lt int2 | int1小于int2为真 |
int1 -le int2 | int1小于等于int2为真 |
表达式 | 逻辑 |
---|---|
-r file | 用户可读为真 |
-w file | 用户可写为真 |
-x file | 用户可执行为真 |
-f file | 文件为正规文件为真 |
-d file | 文件为目录为真 |
-c file | 文件为字符特殊文件为真 |
-b file | 文件为块特殊文件为真 |
-s file | 文件大小非0时为真 |
-t file | 当文件描述符(默认为1)指定的设备为终端时为真 |
表达式 | 逻辑 |
---|---|
-a | 与 |
-o | 或 |
! | 非 |
eg.
|
|
|
|
#file
[ -f “filepath” ] :判断是否是一个文件
[ -d “folerpath” ] :判断是否是一个文件夹
|
|
#Source Control
Find out who commit the bug code .
Just right click on the line and click on “Show Blame for Line
”
#Simulate slow internet
]]>
|
|
|
|
Duplicate
#Rename Target,Scheme And Product
Manage Schemes
Edit Scheme...
Build
tab if there are multiple targets, remove useless targets with unchecking all checkboxes and delete themBuild Setting
change Product Name
from xxx copy
to newName
#Info.plist
rename info.plist ,in Build Settings
General
tag select new plist file
#Preprocessor
Select “Awesome Lite” target > Build Settings > Preprocessing > Preprocessor Macros > Add TARGET_LITE to each of the configuration (eg both Debug and Release configurations).
|
|
#Resources, Images and Assets Catalog
Select the resource > File Inspector > Target Membership > check the targets intended.
|
|
|
|
###objc
|
|
Xcode 5 & Asset Catalog: How to reference the LaunchImage?
For App Icons:
iPhone
iPad
For Launch Images
rclick dock icon Virtual Machines List
-> rclick windows icon Configure
-> Hardware
-> Network 1
-> Type
to Default Adapter
|
|
Xcode 6 missing iOS 8 simulator
iOS Simulator
-> Hardware
-> Device
-> Manage Devices...
click plus button at bottom , create simulators
内存条: 金士顿(Kingston)DDR3 1600 8GB 笔记本内存 地址 http://item.jd.com/664484.html ¥499.00
SSD : 三星(SAMSUNG)850 EVO系列 250G 2.5英寸 SATA-3固态硬盘(MZ-75E250B/CN) 地址 http://item.jd.com/1279827.html ¥819.00
螺丝刀 :宝工(Pro’skit) SD-9802 31合1精密多功能手机起子组 螺丝刀套装 地址 http://item.jd.com/617776.html
]]>【新版】bandwagonhost-美国vps主机最新特价版VPS 支持支付宝
bandwagonhos(搬砖工)美国vps主机商,已经没有以前的便宜货出售了,由于目前他们拿不到低价的IPv4,或者说拿不到低价的大量IP,所以接下来都不会再卖之前3.99美元一年的VPS了
进入搬瓦工ClientArea- https://bandwagonhost.com/clientarea.php输入注册的邮箱和密码登录;
点击Services-My Services-点击你需要架设的VPS对应的KiWiVM Control Panel,这样我们就进入VPS的控制面板(在这里可以看到你的VPS的IP和SSH端口等信息);
点击Stop(停止掉当前的系统)-停止后点击Instal New OS(这个在页面左侧)-进入选择Debian 7 x86,把红字的勾选上,确认,很快你的新系统就安装完成;
新系统安装完成后,搬瓦工会告诉你VPS 新的Root账户密码,以及新的SSH端口,这两项很重要,记下来后面会用到(VPS的root密码可以在Panel里自行设置)。
ssh connect
|
|
|
|
|
|
disable NSAssert in release
mode
in Build Settings
-> Preprocessor Macros
add NS_BLOCK_ASSERTIONS
to release
section
|
|
|
|
|
|
|
|
@tomduncalf’s answer
|
|
pod install
Get error message
|
|
Fix this
|
|
remove it
|
|
To hide username@computername both in local and ssh login mode
Add following lines in .zshrc
Auto switch theme when ssh login
Change theme line in .zshrc
to following lines
Using agnoster
Install powerline/fonts
Change iterm2 font to Ubuntu Mono Derivative Powerline
reference
Add DEFAULT_USER=zx
in ~/.zshrc
to hide username@localhost
Make theme like screenshot
|
|
iTerm
-> Profiles
-> Colors
->Load Presets...
-> Import...
-> Solarized Dark.itermcolors
Install oh-my-zsh by running follow command
|
|
Instead I went to iTerm2
-> Preferences
-> Profiles
-> Default
and in the General
Tab set the Command
to /bin/zsh
instead of Login shell
显示中文
|
|
install autojump
|
|
Adding a certificate authority to the Java runtime
/Users/[ME]/git-tf/
on mac./Users/[ME]/git-tf/
) to your PATH environment variable.open ~/.profile
|
|
|
|
required java version “1.6.0_65” (must)
download Java for OS X 2014-001
|
|
|
|
|
|
git tf configure http://myserver:8080/tfs/mycollection $/TeamProjectA/Main
git tf pull
git commit -a -m “merge commit”
git tf checkin
git push
|
|
git config [–global] core.autocrlf false
git config [–global] core.ignorecase true
```
pod install
Get message like below
|
|
Build project get error below
|
|
#Solution :
Add $(inherited)
to Ohter Linker Flags
Error message
|
|
UI.storyboard
Interface Builder Document
section Opens in
change to Xcode 5.1
Constrain to margins
Xcode
to Xcode6
.Xcode
into Desktop
folder.sudo xcode-select -s /Applications/Xcode.app
to switch between them.https://developer.apple.com/downloads/
Xcode 6
Xcode 5
Xcode 4
|
|
Add the following lines into post-receive
|
|
Then make post-receive
executable
|
|
Create a Zip archive that contains the contents of the latest commit on the current branch.
|
|
How many lines of code differs between two commits?
|
|
git merge tool
|
|
resolve merge conflicts
|
|
fetch from origin with deleted remote branches
|
|
revert git commit on server
Undoing a git push
git reset --hard <commit>
git push -f origin <commit>:<branch>
#reset local and origin <branch> to <commit>
reduce git repository size
git reflog expire --all --expire=now
git gc --prune=now --aggressive
git total count
git rev-list HEAD --count
git rebase
git rebase --onto <newbase> <since> <till>
git rebase -i <newbase>
git help config
git help config
git checkout
git checkout
git reset
git reset --soft <commit> # 不修改工作区和暂存区,只重置master
git reset --hard <commit> # 替换工作区,暂存区,master <commit>
git reset --mixed
git reset
git add .
git reset HEAD . # 撤销 git add .
git reset <commit> <paths> # 重置暂存区为<commit>
git reflog
git reflog #查看之前几次修改 SHA1值
git reset --hard HEAD@{num}
commit count
git rev-list HEAD --count
git clean
git clean -f -d
git stash
# 保存当前工作状态
git add . # 加入index
git stash # 保存 ,当前工作区所有
git stash list # 查看 stash list
git checkout -b new_branch
# do some thing ...
git checkout master
git stash pop # 多个stash 使用git stash pop stash@{num}
后悔药
git checkout HEAD^ -- <file path>
HEAD^ 后悔一步
HEAD^^ 后悔两步
HEAD^^^ ...
HEAD^4 ...
HEAD^5 以此类推
角色: 最近六次提交分别是ABCDEF
$git log --online -6
XXXXXXX modify hello.h # F XXXXXXX add hello.h # E
XXXXXXX ignore object files # D
XXXXXXX move .file outside also works. # C
XXXXXXX Hello world initialized # B
XXXXXXX README is frome welcome.txt # A
坏蛋: 提交 D。
目的就是:干掉提交D
需要拣选指令–git cherry-pick
含义是从众多的提交中挑选出一个提交应用在当前的工作分支中。该命令需要提供一个提交ID作为参数,操作过程相当于讲该提交到出为补丁文件,然后在当前HEAD上重放,形成无论内容还是提交说明都一致的提提交
首先对版本库要‘参演’的角色进行标记,使用git tag
命令
git tag F
git tag E HEAD^
git tag D HEAD^^
git tag C HEAD^^^
git tag B HEAD^4
git tag A HEAD^5
1.第一幕干掉坏蛋 D
(1) 执行 git checkout ,暂时将 HEAD 头指针切换到 C。
切换过程显示非跟踪状态的警告,没有关系,因为剧情需要。
$git checkout C
$git checkout -b new_branch_name
(2) 执行拣选操作将 E 提交在
change some history comment
git rebase -i <commit number>
change last comment
git commit --amend
安装自动补全命令
brew install bash-completion
.gitignore
# 这是注释行 -- 被忽略
*.a # 忽略所有以 .a 为扩展名的文件。
!lib.a # 但是 lib.a 文件或者目录不要忽略,即使前面设置了对 *.a 的忽略。
/TODO # 只忽略此目录下的 TODO 文件,子目录的 TODO 文件不忽略。
build/ # 忽略所有 build/ 目录下的文件
doc/*.txt # 忽略文件如 doc/notes.txt,但是文件如 doc/server/arch.txt 不被忽略。
“# a comment - this is ignored
# no .a files
*.a
# but do track lib.a, even though you're ignoring .a files above
!lib.a
# only ignore the root TODO file, not subdir/TODO
/TODO
# ignore all files in the build/ directory
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .txt files in the doc/ directory
doc/**/*.txt”
remove ignored files
|
|
git rev-list HEAD | wc -l
git rev-list HEAD | wc -l # 查看历史提交次数
git diff
git diff B A # 比较里程碑 B 和里程碑 A
git diff A # 比较工作区和里程碑 A
git diff --cached A # 比较暂存区和里程碑 A
git diff --cached # 比较工作区和暂存区
git diff HEAD # 比较工作区和HEAD
若只有一个参数就是比较工作区和 这个参数
两个参数就是比较两个参数
参数可以是 里程碑 commitId 工作区 等等
git diff <commit1> <commit2> -- <paths>
git blame
git blame <file path> # 文件追溯
]]>
|
|
install
|
|
|
|
|
|
install pip
click here
|
|
|
|
|
|
|
|
/html/head/title
: selects the <title>
element, inside the <head>
element of a HTML document
/html/head/title/text()
: selects the text inside the aforementioned <title>
element
//td
: selectes all the <td>
elements
//div[@class="mine"]
: selects all <div>
elements which contains an attribute class="mine"
dmoz_spider.py
under the tutorial/spiders
directory:
|
|
|
|
|
|
remove the default margin of widget
|
|
发现imessage 不能发图片的问题
cydia 更新 Pangu 8.0-8.1.x Untether
—2014.11.01—
Apple File Conduit "2"
1.2 补丁安装恢复之前破解的,如果之前没有破解过就忽略此步骤
)超雪LTE激活器
”,安装过程中会自动安装CommCenter patch for IOS7
补丁,如果没有请手动安装CommCenter patch for IOS7
,等待重启手机5S/5C移动4G破解
”,让然后安装,该补丁来自于威锋精品源,请注意~,安装完补丁后,手机会重启,重启后,请打开LTE开关,耐心等上一会儿大约在10s~60s左右,LTE信号出现我出现了能收发短信的问题,重启手机解决
]]>
|
|
|
|
简介
Ruby是一种完美的面向对象编程语言。面向对象编程语言的特性包括:
类
在 Ruby 中,类总是以关键字 class 开始,后跟类的名称。类名的首字母应该大写。类 Customer 如下所示:
class Customer
end
Ruby 类中的变量
(给全局变量赋值会改变全局状态,所以不建议使用全局变量)
Ruby 点运算符 “.” 和双冒号运算符 “::”
您可以通过在方法名称前加上模块名称和一条下划线来调用模块方法。您可以使用模块名称和两个冒号来引用一个常量。
:: 是一元运算符,允许在类或模块内定义常量、实例方法和类方法,可以从类或模块外的任何地方进行访问。
请记住:在 Ruby 中,类和方法也可以被当作常量。
您只需要在表达式的常量名前加上 :: 前缀,即可返回适当的类或模块对象。
如果未使用前缀表达式,则默认使用主 Object 类。
下面是两个实例:
|
|
修饰词if
为真,执行后面
|
|
unless 为假,执行后面
|
|
case
|
|
while 为真,继续执行
|
|
修饰符在后的用法
当 conditional 为真时,执行 code。
|
|
until 为假,继续执行
|
|
for
|
|
for…in 循环几乎是完全等价于:
|
|
上例也可以写成
|
|
break,终止最内部的循环。如果在块内调用,则终止相关块的方法(方法返回 nil)。
|
|
next,跳到最内部循环的下一个迭代。如果在块内调用,则终止块的执行(yield 或调用返回 nil)。
|
|
redo,重新开始最内部循环的该次迭代,不检查循环条件。如果在块内调用,则重新开始 yield 或 call。
|
|
retry,如果 retry 出现在 begin 表达式的 rescue 子句中,则从 begin 主体的开头重新开始。
|
|
如果 retry 出现在迭代内、块内或者 for 表达式的主体内,则重新开始迭代调用。迭代的参数会重新评估。
|
|
方法
|
|
返回值
|
|
|
|
可变数量的参数 like python
|
|
类方法
|
|
定义方法
块
|
|
如果您想要传递多个参数,那么 yield 语句如下所示:
|
|
复杂用法
|
|
但是如果方法的最后一个参数前带有 &,那么您可以向该方法传递一个块,且这个块可被赋给最后一个参数。如果 * 和 & 同时出现在参数列表中,& 应放在后面。
|
|
Module
模块常量命名与类常量命名类似,以大写字母开头。方法定义看起来也相似:模块方法定义与类方法定义类似。
通过类方法,您可以在类方法名称前面放置模块名称和一个点号来调用模块方法,您可以使用模块名称和两个冒号来引用一个常量
|
|
require 语句
require 语句类似于 C 和 C++ 中的 include 语句以及 Java 中的 import 语句。如果一个第三方的程序想要使用任何已定义的模块,则可以简单地使用 Ruby require 语句来加载模块文件:
|
|
在这里,我们使用 $LOAD_PATH << ‘.’ 让 Ruby 知道必须在当前目录中搜索被引用的文件。如果您不想使用 $LOAD_PATH,那么您可以使用 require_relative 来从一个相对目录引用文件。
注意:在这里,文件包含相同的函数名称。所以,这会在引用调用程序时导致代码模糊,但是模块避免了这种代码模糊,而且我们可以使用模块的名称调用适当的函数。
support.rb
|
|
|
|
Mixins 多重继承
|
|
String
link
Array
数组的索引从 0 开始,这与 C 或 Java 中一样。一个负数的索引时相对于数组的末尾计数的,也就是说,索引为 -1 表示数组的最后一个元素,-2 表示数组中的倒数第二个元素,依此类推。
Ruby 数组可存储诸如 String、 Integer、 Fixnum、 Hash、 Symbol 等对象,甚至可以是其他 Array 对象。Ruby 数组不像其他语言中的数组那么刚性。当向数组添加元素时,Ruby 数组会自动增长。
创建数组
|
|
哈希(Hash)
哈希(Hash)是类似 “employee” => “salary” 这样的键值对的集合。哈希的索引是通过任何对象类型的任意键来完成的,而不是一个整数索引,其他与数组相似。
通过键或值遍历哈希的顺序看起来是随意的,且通常不是按照插入顺序。如果您尝试通过一个不存在的键访问哈希,则方法会返回 nil。
日期 & 时间(Date & Time)
创建当前的日期和时间
|
|
|
|
范围(Range)
范围(Range)无处不在:January 到 December、 0 到 9、等等。Ruby 支持范围,并允许我们以不同的方式使用范围:
|
|
序列 1..100 是一个 Range 对象,包含了两个 Fixnum 对象的引用。如果需要,您可以使用 to_a 方法把范围转换为列表。尝试下面的实例:
|
|
each 迭代器
|
|
|
|
collect 方法不是数组间进行复制的正确方式。这里有另一个称为 clone 的方法,用于复制一个数组到另一个数组
文件的输入与输出
Ruby 提供了一整套 I/O 相关的方法,在内核(Kernel)模块中实现。所有的 I/O 方法派生自 IO 类。
类 IO 提供了所有基础的方法,比如 read、 write、 gets、 puts、 readline、 getc 和 printf。
本章节将讲解所有 Ruby 中可用的基础的 I/O 函数。如需了解更多的函数,请查看 Ruby 的 IO 类。
puts 语句
|
|
gets 语句
|
|
putc 语句
print 语句
打开和关闭文件
File.new 方法
您可以使用 File.new 方法创建一个 File 对象用于读取、写入或者读写,读写权限取决于 mode 字符串。最后,您可以使用 File.close 方法来关闭该文件。
|
|
mode:
模式 | 描述 |
---|---|
r | 只读模式。文件指针被放置在文件的开头。这是默认模式。 |
r+ | 读写模式。文件指针被放置在文件的开头。 |
w | 只写模式。如果文件存在,则重写文件。如果文件不存在,则创建一个新文件用于写入。 |
w+ | 读写模式。如果文件存在,则重写已存在的文件。如果文件不存在,则创建一个新文件用于读写。 |
a | 只写模式。如果文件存在,则文件指针被放置在文件的末尾。也就是说,文件是追加模式。如果文件不存在,则创建一个新文件用于写入。 |
a+ | 读写模式。如果文件存在,则文件指针被放置在文件的末尾。也就是说,文件是追加模式。如果文件不存在,则创建一个新文件用于读写。 |
读取和写入文件
sysread 方法
|
|
该语句将输入文件的头 20 个字符。文件指针将被放置在文件中第 21 个字符的位置。
syswrite 方法
|
|
该语句将写入 “ABCDEF” 到文件中。
each_byte 方法
|
|
IO.readlines 方法
类 File 是类 IO 的一个子类。类 IO 也有一些用于操作文件的方法。
IO.readlines 是 IO 类中的一个方法。该方法逐行返回文件的内容。下面的代码显示了方法 IO.readlines 的使用:
|
|
IO.foreach 方法
|
|
重命名和删除文件
|
|
文件模式与所有权
|
|
掩码 | 描述 |
---|---|
0700 | rwx 掩码,针对所有者 |
0400 | r ,针对所有者 |
0200 | w ,针对所有者 |
0100 | x ,针对所有者 |
0070 | rwx 掩码,针对所属组 |
0040 | r ,针对所属组 |
0020 | w ,针对所属组 |
0010 | x ,针对所属组 |
0007 | rwx 掩码,针对其他人 |
0004 | r ,针对其他人 |
0002 | w ,针对其他人 |
0001 | x ,针对其他人 |
4000 | 执行时设置用户 ID |
2000 | 执行时设置所属组 ID |
1000 | 保存交换文本,甚至在使用后也会保存 |
文件查询
|
|
您可以通过 Dir.pwd 查看当前目录:
|
|
您可以使用 Dir.entries 获取指定目录内的文件和目录列表:
|
|
Dir.entries 返回一个数组,包含指定目录内的所有项。Dir.foreach 提供了相同的功能:
|
|
创建目录
删除目录
|
|
File 类和方法
Dir 类和方法
异常
面向对象
Ruby 是纯面向对象的语言,Ruby 中的一切都是以对象的形式出现。Ruby 中的每个值都是一个对象,即使是最原始的东西:字符串、数字,甚至连 true 和 false 都是对象。类本身也是一个对象,是 Class 类的一个实例。本章将向您讲解所有与 Ruby 面向对象相关的主要功能。
类用于指定对象的形式,它结合了数据表示法和方法,把数据整理成一个整齐的包。类中的数据和方法被称为类的成员。
类定义
按照惯例,名称必须以大写字母开头,如果包含多个单词,每个单词首字母大写,但此间没有分隔符(例如:CamelCase)。
|
|
initialize 方法
|
|
实例变量
|
|
访问器 & 设置器 方法
|
|
类方法 & 类变量
|
|
访问控制
|
|
运算符重载
|
|
冻结对象
|
|
类常量
您可以在类的内部定义一个常量,通过把一个直接的数值或字符串值赋给一个变量来定义的,常量的定义不需要使用 @ 或 @@。按照惯例,常量的名称使用大写
。
一旦常量被定义,您就不能改变它的值
,您可以在类的内部直接访问常量,就像是访问变量一样,但是如果您想要在类的外部访问常量,那么您必须使用 classname::constant,如下面实例所示。
|
|
使用 allocate 创建对象
可能有一种情况,您想要在不调用对象构造器 initialize 的情况下创建对象,即,使用 new 方法创建对象,在这种情况下,您可以调用 allocate 来创建一个未初始化的对象,如下面实例所示:
|
|
正则表达式
正则表达式从字面上看是一种介于斜杠之间或介于跟在 %r 后的任意分隔符之间的模式,如下所示:
|
|
pic says every thing
]]>http://jekyllbootstrap.com/usage/jekyll-quick-start.html
##Find Themes
http://themes.jekyllbootstrap.com
##Install Themes
rake theme:install git=”https://github.com/jekyllbootstrap/theme-the-program.git“
if build error is If you haven't initialized your submodule
just add
[submodule “_theme_packages/theme-name”]
path = _theme_packages/theme-name
url = https://github.com/theme-name/theme-name.git
ignore = dirty
cd the submodule’s directory, run git submodule init
, then git submodule update
.
##Switch Themes
rake theme:switch name="the-program"
]]>iphone 上安装app的非主流安装机制 有以下几种
Ad hoc 证书打包 参考官方文档 #苹果官方提供给ios 开发者的内测机制
企业级证书打包 #申请企业级证书 打包ipa 并安装
第三方应用商店安装(越狱和非越狱两种,本文暂不讨论
)
##打包机制讨论:
Ad hoc 证书打包,只能为Apple Developer Center 里面注册的设备(至多100个设备)安装app
企业级 证书打包(无设备数量限制)
##安装方式:
用户下载ipa文件至电脑,通过iTunes(或者三方手机助手pc端)的同步app功能,把ipa同步到手机,完成安装
用户下载ipa文件至手机,通过第三方手机助手iphone端(如同步推)的选择用同步推打开,并点击安装,完成安装
远程安装通过苹果提供的itms-services
协议,完成安装。(参考Ad hoc 教程 3 ==> ipa 的远程安装)
##问题来了
开发时如何简单的打包ipa,并通过ota安装到手机?
有以下3种方式
用IIS或者python脚本配置一个https的服务器(不推荐),推荐使用github的raw功能参考demo-plist,将plist文件(plist字段详解)放在服务器上,通过写一个页面,或者应用内部打开,手动在Safari地址栏输入itms-services://?action=download-manifest&url=plistUrl
,完成安装
在Mac上直接使用terminal
cd到ipa目录,并用python -m SimpleHTTPServer 端口号
建立一个SimpleHTTPServer,通过iphone访问本机ip加端口号,下载ipa到手机用安装方式2
完成安装
##Company Name
##App Name
##App by Company
auto_synch_this_path.command
content as
cd `dirname $0`;git status;git add -A;git commit -m 'zx';git pull;git push
$ chmod a+x auto_synch_this_path.command
now can run this script by double click
]]>download BBUncrustifyPlugin and install
open Xcode
Edit
->Format Code
->BBUncrustifyPlugin Prefreences
set Formatter
to Uncrustify
open Terminal
run git clone https://github.com/bumaociyuan/uncrustify.cfg .uncrustify
set shortcut for Format Active File
with this article
UncrustifyX allows importing and exporting of Uncrustify .cfg files, and provides a GUI to run a configuration set on a list of files, or direct source code input.
##Have fun
]]>;d:\python27
;.PY;.PYM
Some others:
VPN: prefs:root=General&path=VPN
Phone App: mobilephone://
Settings App: prefs:root
—2014.10.09—
prefs:root=General&path=About
prefs:root=General&path=ACCESSIBILITY
prefs:root=AIRPLANE_MODE
prefs:root=General&path=AUTOLOCK
prefs:root=General&path=USAGE/CELLULAR_USAGE
prefs:root=General&path=Bluetooth
prefs:root=General&path=DATE_AND_TIME
prefs:root=FACETIME
prefs:root=General
prefs:root=General&path=Keyboard
prefs:root=CASTLE
prefs:root=CASTLE&path=STORAGE_AND_BACKUP
prefs:root=General&path=INTERNATIONAL
prefs:root=LOCATION_SERVICES
prefs:root=ACCOUNT_SETTINGS
prefs:root=MUSIC
prefs:root=MUSIC&path=EQ
prefs:root=MUSIC&path=VolumeLimit
prefs:root=General&path=Network
prefs:root=NIKE_PLUS_IPOD
prefs:root=NOTES
prefs:root=NOTIFICATIONS_ID
prefs:root=Phone
prefs:root=Photos
prefs:root=General&path=ManagedConfigurationList
prefs:root=General&path=Reset
prefs:root=Sounds&path=Ringtone
prefs:root=Safari
prefs:root=General&path=Assistant
prefs:root=Sounds
prefs:root=General&path=SOFTWARE_UPDATE_LINK
prefs:root=STORE
prefs:root=TWITTER
prefs:root=General&path=USAGE
prefs:root=VIDEO
prefs:root=General&path=Network/VPN
prefs:root=Wallpaper
prefs:root=WIFI
prefs:root=INTERNET_TETHERING
]]>Xcode
的 Archive
System Preferences
-> Keyboard
-> Shortcuts
-> App Shortcuts
-> plus buttonOK~
]]>###方式一:
语法格式: chmod [-vR] mode 文件名
参数说明:
例:
我们要将当前目录下name这个文件的权限修为所有用户拥有该文件的读取、写入、执行的权限。
$ chmod a+rwx name
或者使用
$ chmod ugo+rwx name
###方式二:
语法格式: chmod [-vR] [No] 文件名
参数说明:
可能这种方式对于初学者来说有一定的难度,但这种方法学会后在更改文件权限就变得非常的简单。相信通过我的介绍大家会掌握种方法的:)
首先了解一下读取(r)、写入(w)、执行(x)相应的数字编号,如下图所示
void (^someBlock)(NSMutableArray *,id) = ^(NSMutableArray *items,NSString *item) {
//do some thing
};
someBlock(items, item);
use block as type
1
@property (nonatomic, strong) returnType(^propertyName)(arguments);
e.g.
@property (nonatomic, strong) void(^onSelectedCustomer)(NSArray *customers);
2
typedef returnType(^name)(arguments);
e.g.
typedef void(^BlockType)(id);
@property (nonatomic, strong) BlockType block;
use block as method parameter
- (void)methodWithBlock:(returnType(^)(arguments))block
e.g.
- (void)loginAnimated:(BOOL)animated completion:(void(^)(void))completion failed:(void(^)(void))failed;
]]>$sudo mdutil -E /Volumes/Macintosh\ HD/
$sudo mdutil -a -i on
]]>
|
|
download
|
|
|
|
断点续传
|
|
-C -
可以自动识别offet续传
#wget
Solution:
|
|
Bug: Right aligned UITextField spacebar does not advance cursor in iOS 7
FXForms/issues/106
Solution:
|
|
Bug: UITableViewCell textLabel offset
Solution:
|
|
Bug: Why is detailTextLabel not visible?
Solution:
|
|
update February 11, 2015
HowTo: Save A File In Vim / Vi Without Root Permission
|
|
update December 28, 2014
update vim
|
|
pratical vim
update 2014.12.07
:%s/targetWord/relpaceWord/g <Enter>
:%s/targetWord/relpaceWord/gc <Enter>
vimtutor
###vim基本命令
1.i
#按一下i键,下端显示 –INSERT–
#插入命令,在vim中可能任意字符都有作用
3.Esc
#退出i(插入)命令进行其它命令使用
6.:w
#在编辑的过程中保存文件,相当于word中的ctrl+s
7.:! command
暂时离开 vi 到指令列模式下执行 command 的显示结果!例如
:!ls
#在编辑过程中执行shell命令ls
8.:sh
#进入shell命令行,执行完命令后ctrl+d退出重新进入vim编辑继续编辑
在shell命令下,执行ctrl+l完成清屏
9.:wq
#保存文件并退出
10.ZZ
#保存文件并退出,同上一个命令,注意大写
11.:q!
#强制退出,不保存
14.:help i
#查看插入命令帮助
15.u
#撤消上一步操作
16./someWord
#查找someWord字符
17.:s /Fedora/Redhat
#将Fedora字符替换为Redhat(只替换在光标所在的行)
18.dw
#删除单词dd
#删除行
19.o
#打开空白一行
20.vim + filename
#进行文件最后一行进行编辑
21.vim +n filename
#进入文件第n行进行编辑
###VIM光标控制命令
h
向左移一个字符
j
向下移一行
k
向上移一行
l
向右移一个字符
G
移到文件的最后一行
w
移到下一个字的开头
W
移到下一个字的开头,忽略标点符号
b
移到前一个字的开头
B
移到前一个字的开头,忽略标点符号
L
移到屏幕的最后一行
nL
将光标移动到屏幕底行上的第 n 行
M
移到屏幕的中间一行
H
移到屏幕的第一行
nH
将光标移动到屏幕顶行下的第 n 行
e
移到下一个字的结尾
E
移到下一个字的结尾,忽略标点符号
(
移到句子的开头
)
移到句子的结尾
{
移到段落的开头
}
移到下一个段落的开头
0
移到当前行的第一列
^
移到当前行的第一个非空字符
$
移到当前行的最后一个字符
+
移到下一行的第一个字符
\-
移到前一行的第一个非空字符
###屏幕调整
ctrl+e
将屏幕上滚一行
ctrl+y
将屏幕下滚一行
ctrl+u
将屏幕上滚半页
ctrl+d
将屏幕下滚半页
ctrl+b
将屏幕上滚一页
ctrl+f
将屏幕下滚一页
ctrl+l
重绘屏幕
z-return
将当前行置为屏幕的顶行
nz-return
将当前行下的第 n 行置为屏幕的顶行
z\.
将当前行置为屏幕的中央
nz.
将当前行上的第 n 行置为屏幕的中央
z-
将当前行置为屏幕的底行
nz-
将当前行上的第 n 行置为屏幕的底行
###进入插入模式
a 在光标后插入文本
A 在当前行插入文本
i 在光标前插入文本
I 在当前行前插入文本
o 在当前行的下边插入新行
O 在当前行的上边插入新行
s 删除光标所在处字符,并进入插入模式
S 删除光标所在的行,并进入插入模式
###删除文本
x 删除光标处的字符
dw 删至下一个字的开头
dG 删除行,直到文件结束
dd 删除整行
db 删除光标前面的字
:n,md 从第 m 行开始往前删除 n 行
d, d$ 从光标处删除到行尾
^h, backspace 插入时,删除前面的字符
^w 插入时,删除前面的字
###修改文本
rchar 用 char 替换当前字符
R text escape 用 text 替换当前字符直到按下
Esc 键
stext escape 用 text 代替当前字符
S 或 cctext escape 用 text 代替整行
cwtext escape 将当前字改为 text
Ctext escape 将当前行余下的改为 text
cG escape 修改至文件的末尾
ccursor_cmd text escape 从当前位置处到光标命令位置处都改为 text
###查找与替换
/text 在文件中向前查找 text
?text 在文件中向后查找 text
n 在同一方向重复查找
N 在相反方向重复查找
ftext 在当前行向前查找 text
Ftext 在当前行向后查找 text
ttext 在当前行向前查找 text,并将光标定位在 text 的第一个字符
Ttext 在当前行向后查找 text,并将光标定位在 text 的第一个字符
:set ic 查找时忽略大小写
:set noic 查找时对大小写敏感
:ranges/pat1/pat2/g 用 newtext 替换 oldtext
:m,ns/oldtext/newtext 在 m 行通过 n,用 newtext 替换 oldtext
& 重复最后的 :s 命令
:g/text1/s/text2/text3 查找包含 text1 的行,用 text3 替换 text2
:g/text/command 在所有包含 text 的行运行 command 所表示的命令
:v/text/command 在所有不包含 text 的行运行 command 所表示的命令
###复制文本
yy 将当前行的内容放入临时缓冲区
nyy 将 n 行的内容放入临时缓冲区
p 将临时缓冲区中的文本放入光标后
P 将临时缓冲区中的文本放入光标前
“(a-z)nyy 复制 n 行放入名字为圆括号内的可命名缓冲区,省略 n 表示当前行
“(a-z)ndd 删除 n 行放入名字为圆括号内的可命名缓冲区,省略 n 表示当前行
“(a-z)p 将名字为圆括号的可命名缓冲区的内容放入当前行后
“(a-z)P 将名字为圆括号的可命名缓冲区的内容放入当前行前
###撤消与重复
u 撤消最后一次修改
U 撤消当前行的所有修改
. 重复最后一次修改
, 以相反的方向重复前面的 f、F、t 或 T 查找命令
; 重复前面的 f、F、t 或 T 查找命令
“np 取回最后第 n 次的删除(缓冲区中存有一定次数的删除内容,一般为 9)
n 重复前面的 / 或 ? 查找命令
N 以相反方向重复前面的 / 或 ? 命令
保存文本和退出 vi
命令 保存和/或退出操作
:w 保存文件但不退出 vi
:w file 将修改保存在 file 中但不退出 vi
:wq 或 ZZ 或 :x 保存文件并退出 vi
:q! 不保存文件,退出 vi
:e! 放弃所有修改,从上次保存文件开始再编辑
:!command 执行 shell 的 command 命令,如 :!ls
:!! 执行前一个 shell 命令
:r!command 读取 command 命令的输入并插入,如 :r!ls 会先执行 ls,然后读入内容
:w!command 将当前已编辑文件作为 command 命令的标准输入并执行 command 命令,如 :w!grep all
:cd directory 将当前工作目录更改为 directory 所表示的目录
:sh 将启动一个子 shell,使用 ^d(ctrl+d) 返回 vi
:so file 在 shell 程序 file 中读入和执行命令
###宏与缩写
(避免使用控制键和符号,不要使用字符 K、V、g、q、v、*、= 和功能键)
:map key command_seq 定义一个键来运行 command_seq,如 :map e ea,无论什么时候都可以 e 移到一个字的末尾来追加文本
:map 在状态行显示所有已定义的宏
:umap key 删除该键的宏
:ab string1 string2 定义一个缩写,使得当插入 string1 时,用 string2 替换 string1。当要插入文本时,键入 string1 然后按 Esc 键,系统就插入了 string2
:ab 显示所有缩写
:una string 取消 string 的缩写
###缩进文本
ctrl+i或 tab 插入文本时,插入移动的宽度,移动宽度是事先定义好的
:set ai 打开自动缩进
:set sw=n 将移动宽度设置为 n 个字符
n> 使 n 行都向右移动一个宽度,例如 3>> 就将接下来的三行每行都向右移动一个移动宽度
|
|
Where 3600 is the number of seconds in one hour. You may modify it to any number of seconds, or alternatively just enter caffeinate without a timer to disable sleep mode until that terminal window is closed.
January 14, 2015
List Your 15 Most Used Terminal Commands
|
|
Linux Shell Scripting Tutorial v1.05r3
A Beginner’s handbook
—2014.12.05–
Ctrl + A
Go to the beginning of the line you are currently typing on
Ctrl + E
Go to the end of the line you are currently typing on
Ctrl + U
Clear the line before the cursor
Ctrl + K
Clear the line after the cursor
Ctrl + W
Delete the word before the cursor
—2014.11.09–
|
|
—–2014.10.25——-
创建以当前时间为文件名的
mkdir date +%Y%m%d
split
|
|
|
|
—–2014-09-04——-
!! (”连续两个”!”),表示执行上一条指令
!字符串(字符串大于等于1),例如!ta,表示执行命令历史中最近一次以ta为开头的指令。
按tab键,它可以帮你补全一个指令,也可以帮你补全一个路径或者一个文件名。连续按两次tab键,系统则会把所有的指令或者文件名都列出来。
前面已经提过过管道符”|”,就是把前面的命令运行的结果丢给后面的命令。
你可以使它暂停(按Ctrl+z),然后使用fg命令恢复它
,利用bg命令使他到后台运行,你也可以使它终止(按Ctrl+c)。
|
|
|
|
|
|
‘!$’表示上条命中中最后一个变量(也许称为变量不合适,总之就是上条命令中最后出现的那个东西)例如上边命令最后是test.txt那么在当前命令下输入!$则代表test.txt。
cut :截取某一个字段 -d :后面跟分隔字符,分隔字符要用双引号括起来, -c :后面接的是第几个字符, -f :后面接的是第几个区块
sort :用做排序 -t 分隔符 :作用跟cut的-d一个意思, -n :使用纯数字排序, -r :反向排序, -u :去重复
|
|
error- ERROR | [watchOS] Returned an unsuccessful exit code.
blabla
add flowing code in podspec
|
|
—2014.11.05—
update lib
edit the NSString-BlockHelper.podspec
add 1.0.1
version
|
|
get error You need to register a session first.
|
|
pod search
cannot search the 1.0.1
version
but pod install
in new project can install 1.0.1
—2014.08.29—
demo : link
|
|
git tag 1.0.0; git push --tags
pod trunk push NSString-BlockHelper.podspec --verbose
to push .podspec to repo/etc/apache2
#LoadModule php5_module libexec/apache2/libphp5.so
Remove the “#”sudo apachectl restart
to restart apachelocalhost
you will see It works!/etc/apache2/httpd.conf
Search for “virtual” in your text editor. You should see the following lines:
|
|
Uncomment the second line that starts with “#Include” by removing the “#”. We now need to modify httpd-vhosts.conf file to add our virtual hosts.
/etc/apache2/extra/httpd-vhosts.conf
|
|
sudo su
/Applications/XAMPP/xamppfiles/xampp start
if you see
|
|
do these commands
|
|
Request failed: unacceptable content-type: text/html
or
The operation couldn’t be completed (Cocoa error 3840 )
fix this issue
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager new];
NSMutableSet *set = manager.responseSerializer.acceptableContentTypes.mutableCopy;
[set addObject:@"text/html"];
manager.responseSerializer.acceptableContentTypes = set;
]]>在AppDelegate里面init BMapManager以后。
设为属性
不然会出各种问题
|
|
December 27, 2014 update
link
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
in AppDelegate.m
UINavigationBar * bar = [UINavigationBar appearance];
bar.backIndicatorImage = [UIImage imageNamed:@"navBackButton"];
bar.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"navBackButton"];
in BaseViewController.m
-viewdidload
self.navigationItem.leftItemsSupplementBackButton = YES;
self.navigationItem.backBarButtonItem = [self textBarButtonItemWithText:@""];
cannot handle the back bar button item click event
]]>
|
|
|
|
|
|
#group style tableview background color in ios 7
|
|
#ios 8
|
|
|
|
Set the source repository as upstream:
git remote add upstream https://github.com/{user}/{source-repo}.git
Fetch the full upstream repository. (Right now, you only have a copy of its master branch.)
git fetch upstream
Make your file system copy the branch you want and give it any name:
git checkout upstream/{branch-in-question}
git checkout -b temporary
Publish your repo using the GitHub desktop application.
On the GitHub website, open your repository and click ‘settings’.
Delete the master branch on your shell and make a new master branch:
git branch -d master
git branch master
git checkout master
git -d temporary
Once more, publish your repo using the GitHub desktop application.
On the GitHub website, open your repository and click ‘settings’.
This should be what you were looking for. Perhaps GitHub will provide a more convenient way to do this in future (e.g., clicking “Fork” from a project’s branch results in exactly this behaviour).
]]>
|
|
|
|
|
|
|
|
|
|
Tip
文件名须反映出其实现了什么类 – 包括大小写。遵循你所参与项目的约定。
类别的文件名应该包含被扩展的类名,如:GTMNSString+Utils.h 或GTMNSTextView+Autocomplete.h
。
Tip
方法名应该以小写字母开头,并混合驼峰格式。每个具名参数也应该以小写字母开头。
变量命名需要能明白两点
以 is
开头
如:
//GOOD
BOOL isShouldReload;
BOOL isLoading;
//AVOID
BOOL k;
以 s
结尾 或者 Array
如:
NSArray *users;
NSArray *messages
以 Dic
结尾 或服务器返回对象
NSDictionary *dateDic;
NSDictionary *message;
以 String
结尾 ,字段可以不用String
结尾
NSString *urlString;
@property (nonatomic,strong) NSString * topId;//尽量与服务器统一
以 class
结尾 尽量不使用btn
tv
等简写
如:
//GOOD
UIButton *loginButton
UITextField *passwordTextField;
//AVOID
UIButton *login;
UITextField *password;
以 on
开头
typedef void(^OnCompletion)(API *, id value);
typedef void(^OnFailed)(API *, id error);
OnCompletion onCompletion;
OnFailed onFailed;
fds
]]>February 4, 2015
Showing first 200 notices only
静态库重复
Mach O Link Error- linker command failed with exit code 1 (use -v to see invocation)
link
E79CDDB501B68E74DDF03EA4E75246A7FDF010D0: no identity found Command /usr/bin/codesign failed with exit code 1
Xcode > Preferences > Accounts > View Details > And just refresh the Provisioning Profile
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
将Apple LLVM compiler 4.2 - Language ->c++ Standard Library 修改为 libstdc++ (GNU C++ standard library)
Could not change executable permissions on the application.
Delete the app, restart iPhone
]]>https://github.com/bumaociyuan/wiki
—2014.09.26—
中国大陆 www.google.cn
沙特阿拉伯 www.google.com.sa
澳大利亚 www.google.com.au
罗马尼亚 www.google.ro
马来西亚 www.google.com.my
加拿大 www.google.ca
埃及 www.google.com.eg
智利 www.google.cl
以色列 www.google.co.il
法国 www.google.fr
土耳其 www.google.com.tr
希腊 www.google.gr
新加坡 www.google.com.sg
阿联酋 www.google.ae
中国台湾 www.google.com.tw
英国 www.google.co.uk
瑞典 www.google.se
波兰 www.google.pl
西班牙 www.google.es
阿根廷 www.google.com.ar
意大利 www.google.it
中国香港 www.google.com.hk
比利时 www.google.be
德国 www.google.de
法国 www.google.fr
英国 www.google.co.uk
日本特别行政区 www.google.co.jp
韩国 www.google.co.kr
意大利 www.google.it
瑞士 www.google.ch
加拿大 www.google.ca
以色列 www.google.co.il
荷兰 www.google.nl
比利时 www.google.be
智利 www.google.cl
阿根廷 www.google.com.ar
巴拿马 www.google.com.pa
奥地利 www.google.at
波兰 www.google.pl
俄罗斯 www.google.com.ru
巴西 www.google.com.br
新西兰 www.google.co.nz
维京群岛 www.google.vg
]]>find dir-path -name .DS_Store -delete
or cd to the path
find . -name .DS_Store -delete
]]>init
git init
add remote url
git remote add origin repo-url
delete remote url
git remote rm origin
clone from remote
git clone repo-url
check status
git status
add all changes
git add . #add all file in current folder
git add -A #git
add some file
git add file-path
commit to repo
git commit -m 'comment'
remove all commits not in origin/master
git reset --hard origin/master
push to remote
git push
log
git log #查看最近 提交
git log -10 #查看最近 提交 -10
git log --graph #查看最近 提交 --graph
gitk #GUI查看提交记录,需要用homebrew 升级git
gitk file-path #GUI查看filefile-path提交记录
git log --decorate
git log --decorate --all --oneline --graph
checkout
git checkout .
git checkout <commit number> <filename> #**常用**
git checkout 3f33b7959ff97715d69e418620895d98b811f8cb folder-name/* #恢复某folder-name下所有文件到 3f33b7959ff97715d69e418620895d98b811f8cb
撤销提交
git revert
view branches
git branch #查看本地分支
git branch -a #查看本地和服务器分支
create new branch
git branch new-branch-name
switch branch
git checkout branch-name #切换到branch-name
git merge from dev to master
git checkout master
git merge dev
delete branch
git branch -D branch-name #删除本地分支branch-name
git push origin --delete branch-name #删除服务器分支branch-name
基于远程跟踪分支创建本地分支
git checkout --track -b branch-name-on-local origin/branch-name-on-server
diff
git diff master origin/master # 比较 master(本地) 和服务器 master 的差异
push to server
git push origin branch-name-on-server
tag
git tag #查看所有标签
git tag v0.1.2-light #创建轻量标签
git tag -a v0.1.2 -m “0.1.2版本” #创建附注标签
git checkout tag-name
git tag -d v0.1.2 #删除标签
git tag -a v0.1.1 9fbc3d0 #补打标签
git push --tags
通常的git push不会将标签对象提交到git服务器,我们需要进行显式的操作:
git push origin tag-name #将tag-name标签提交到git服务器
git push origin –tags #将本地所有标签一次性提交到git服务器
push all
git push --all #push 所有branch
git push --all origin #push 所有tag 和所有branch到服务器
]]>$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org
# 请确保只有 ruby.taobao.org
$ gem install rails
]]>Create a New Repository
Go to your https://github.com and create a new repository named USERNAME.github.com
install jekyll
|
|
|
|
commit ur changes to github,visit USERNAME.github.io
运行 cmd
cd 到 adb 文件夹
并连接 mi tv 的ip
adb install file path
安装apk
upload your app.plist to dropbox
get shared link of app.plist, like https://www.dropbox.com/s/qgknrfngaxazm38/app.plist
replace www.dropbox.com with dl.dropboxusercontent.com in the link, likehttps://dl.dropboxusercontent.com/s/qgknrfngaxazm38/app.plist
write your download.html like INSTALL!!
upload the download.html to dropbox
get shared link of download.html, like https://www.dropbox.com/s/gnoctp7n9g0l3hx/download.html
replace www.dropbox.com with dl.dropboxusercontent.com in the second link as well, likehttps://dl.dropboxusercontent.com/s/gnoctp7n9g0l3hx/download.html
Now, visit https://dl.dropboxusercontent.com/s/gnoctp7n9g0l3hx/download.html in your device, you can install the app like before.
WHAT A WONDERFUL WORLD!
]]>点击
应用名称:应用名称 human readable
应用类型:for mobile
禁用服务:不选
安全码: 应用唯一标识符 bundle identifier
save
]]>_mapManager = [[BMKMapManager alloc]init];
error message:
-[__NSCFString stringFromMD5]: unrecognized selector sent to instance 0x145925d0
resolve:
other linker flags 添加 -Objc 或者-all_load
Project ->build settings ->linking->Other Linker flags
注意打包时不能连接手机!特别是5s 不然会出现5s可以安装,其他设备不能安装的bug,原因是5s 是64位
生成证书参考:Ad hoc 教程 1 ==> 生成证书
用itunes安装参考:Ad hoc 教程 2==> 通过itunes安装ipa
ipa 的远程安装
主要是使用苹果的itms协议
通过safari打开itms-services://?action=download-manifest&url=https://10.0.0.23:8000/srp.plist
或者应用内调用
|
|
iOS7 以上必须使用https 服务器存放plist
标准plist
|
|
需要配置的 字段
bundle-identifier ==> bundle identifier
bundle-version ==> bundle version
title ==> 安装的时候显示的title
software-package ==> ipa url #必须
display-image ==> 144 * 144 icon url
full-size-image ==> 512 * 512 icon url
需要两个三方库 sourceCode
ChromeBasedWebBrowser.rar
,xulrunner-1.9.en-US.win32.zip
1,新建一个class 继承 Skybound.Gecko.GeckoWebBrowser
Imports Skybound.Gecko
Public Class FasterBrowser
Inherits GeckoWebBrowser
End Class
2,在ui 上加入 new class
3,
Imports Skybound.Gecko
Public Class Form1
Sub New()
InitializeComponent()
Xpcom.Initialize(Environment.CurrentDirectory + "lrunner")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
FasterBrowser1.Navigate("http://www.zmaitech.com")
End Sub
End Class
]]>- (void)showErrorWithTitle:(NSString *)title message:(NSString *)message
cancelButtonTitle:(NSString *)cancelButtonTitle
otherButtonTitles:(NSString *)otherButtonTitles, ... {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:cancelButtonTitle
otherButtonTitles:nil];
va_list args;
va_start(args, otherButtonTitles);
for (NSString *arg = otherButtonTitles; arg != nil; arg = va_arg(args, NSString*))
{
[alert addButtonWithTitle:arg];
}
va_end(args);
[alert show];
[alert release];}
]]>.mobileprovision
Onavo
app
运行,按指示操作,安装provision 文件进入系统设置->通用->VPN选 圈i 关闭按需连接ok需要用的时候 ,进入系统设置 打开VPN就 可以使用了。
]]>sudo gem install cocoapods
sudo gem update cocoapods
error:
To solve this error
run this command :
sudo xcode-select -switch /Applications/Xcode.app
platform :ios, "7.0"
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
]]>Add shortcut for servicesKeyboard
-> Shortcuts
-> Services
-> The new Service
add shortcut
in Xcode many shortcuts not workingcmd+shift+X
works well
##2013-10-11
reference stackoverflow
example
search:NSLocalizedString(@"words", nil)
with regex:
(NSLocalizedString\()(@"\w+")(, nil\))
relace regex:
ZXLocalizeble\(\2\)
replace all
result: ZXLocalizeble(@"words")
insert return
press ctrl+q
press return
Icon
Icon-Small.png 29*29
Icon-Small@2x.png 58*58
Icon-Small-50.png 50*50
Icon-Small-50@2x.png 100*100
Icon.png 57*57
Icon@2x.png 114*114
Icon-72.png 72*72
Icon-72@2x.png 144*144
new added
Icon-76.png 76*76
Icon-120.png 120*120
Icon-152.png 152*152
iTunesArtwork 512*512
然后生成certSigningRequest, 点击keychain 如下图
然后
email 最好输 apple 账号的证书
common name 就是 这个key 的名字
ca email 不填
选saved to disk
click continue
choose File 刚刚生成的 certSigningRequest 点击Generate 如下图
添加APP ID 点击 App IDs
新建
App ID Description 就是Description
选择Wildcard App ID 填 类似com.companyname.*
生成通用app id(pushID 需要选择Explicit App ID)
点击Devices 添加设备,输入名字和UDID即可
最后生成Provisioning Profiles
选择类型
下一步选择 App ID
再下一步选择证书
再下一步选择设备(Distribution 不用这步)
再下一步输入name 最后生成
生成后下载
调试:
双击cer文件
双击provisioning 文件或者直接拖进 xcode organizer
xcode 中的
targets 和 project 选择证书
注意 bundle identifier 要和 App ID 一致
然后选择真机就可以调试了
]]>Automator
->Application
->Run Shell Script
cmd+s
File Format
as Application
System Preferences
->Usres & Groups
->Login Items
->plus button->select the app you just created—2013-07-26—
打开 as编辑器
tell the application "Terminal"
do script "python /Users/noteant-3/Documents/ wallproxy-master/local/startup.py"
close the 1st window
end tell
quit
save as app
右键显示包内容可以修改 icon
icon binder 可以简单生成 icon
最后在login items 加入 wallproxy app 就ok了