Java Effective

Chapter 2. Creating and Destroying Objects Item 1: Consider static factory methods instead of constructors Item 2: Consider a builder when faced with many constructor parameters Item 3: Enforce the singleton property with a private constructor or an enum type Item 4: Enforce noninstantiability with a private constructor Item 5: Avoid creating unnecessary objects Item… Continue reading Java Effective

Adding an existing project to GitHub using the command line

Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. Open Terminal. Change the current working directory to your local project. Initialize the local directory as a Git repository. Add the… Continue reading Adding an existing project to GitHub using the command line

How to enable Google-Login + AWS-Cognito in Mobile platform

Create project in Google Filebase(https://console.firebase.google.com/): Creat a Web Client ID on Google Console page:https://console.developers.google.com/apis/credentials?project=mts-service-tips -“Create credentials” -> “OAuth client ID” -“Web application” -> “Create” Copy the Client ID of the Web application you just created to put in your Android gradle file: GOOGLE_WEB_CLIENT_ID=588682943670-9du92ps4tu9j477aqikdq201bpds8d65.apps.googleusercontent.com Copy Client ID from Android Client, put in IAM > Providers >… Continue reading How to enable Google-Login + AWS-Cognito in Mobile platform

Git常用操作命令

reference: http://www.cnblogs.com/xingzhi/archive/2011/09/30/2196214.html http://nvie.com/posts/a-successful-git-branching-model/ 回退到某个版本,放弃这个版本之后的commit git reset f0ad346f8b000add810fd7a6f986c8e813b36a41 放弃最近一次的commit: git reset --soft HEAD1 远程仓库相关命令 检出仓库:$ git clone git://github.com/jquery/jquery.git 查看远程仓库:$ git remote -v 添加远程仓库:$ git remote add name url 删除远程仓库:$ git remote rm name 修改远程仓库:$ git remote set-url --push name newUrl 拉取远程仓库:$ git pull remoteName localBranchName 推送远程仓库:$ git push remoteName localBranchName 分支(branch)操作相关命令 查看本地分支:$ git branch 查看远程分支:$ git branch -r 创建本地分支:$ git branch name… Continue reading Git常用操作命令

How to enable Google-Login + AWS-Cognito in Mobile platform

Create project in Google Filebase(https://console.firebase.google.com/): Creat a Web Client ID on Google Console page:https://console.developers.google.com/apis/credentials?project=mts-service-tips-“Create credentials” -> “OAuth client ID” -“Web application” -> “Create” Copy the Client ID of the Web application you just created to put in your Android gradle file: GOOGLE_WEB_CLIENT_ID=588682943670-9du92ps4tu9j477aqikdq201bpds8d65.apps.googleusercontent.com Copy Client ID from Android Client, put in IAM > Providers > accounts.google.com… Continue reading How to enable Google-Login + AWS-Cognito in Mobile platform

RAM Disk on Mac

原文链接:http://www.toutiao.com/a6412375956519403778/?tt_from=weixin&utm_campaign=client_share&app=news_article&utm_source=weixin&iid=9729151087&utm_medium=toutiao_ios&wxshare_count=1 实现方法 方法的思路很简单,大概可以分两步: 1.配置 RAM。在内存中专门开出一块让 Xcode 使用。 2.连接 Xcode。让 Xcode 连接到我们开辟出来的专属内存空间。 下面就是见证奇迹的时刻。 第一步, 创建 .sh 文件。代码如下 #!/bin/bash RAMDISK="ramdisk" SIZE=1024 #size in MB for ramdisk.· diskutil erasevolume HFS+ $RAMDISK `hdiutil attach -nomount ram://$[SIZE*2048]` 第二步, 运行 .sh 文件。在命令行中敲下 之后你会发现你会多出一个叫 ramdisk 的内存空间,有大概 1 GB 大小。 第三步,连接 Xcode。Xcode -> Preferences -> Locations -> Locations Tab,配置 DerivedData。 Advanced... 也要配置成下图所示 以上就是全部步骤。这时候你就可以享受飞一般的开发了。现在… Continue reading RAM Disk on Mac

Posted in Mac

git squash

1. Add a global "squash" alias from bash git config --global alias.squash '!f(){ git reset --soft HEAD~${1} && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"; };f' 2. ~/.gitconfig should now contain this alias: [alias] squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f" 3. Usage git… Continue reading git squash