github and bitbucket, and more
Blogs20152015-11-20
1. github and bitbucket
bitbucket and github are Complementary:
- github.com for public repository.
- bitbucket.com for private repository.
- They all use git tool to access.
2. custom git PS1
And, I like this in mac~.bash_profile:
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/ (1)/'
}
export PS1="u@h W[33[32m]$(parse_git_branch)[33[00m] $ "
set -o vi
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi3. Angular promise example
//1. in ui-router:
resolve: {
friends: ['$http', function($http) {
return $http.get('/api/friends.json').then(function(data) {
return response.data;
});
}]
}
//2. in controller:
.controller('ctrl', ['$scope', 'friends', function($scope, friends) {
$scope.friends = friend;
}]);
//3. or wrap Friends in a factory:
resolve: {
friends: ['Friends', function(Friends) {
return Friends.get();
}]
}
//4. keys: when using $http + resolve, using then() instead of success()
return $http.get('api/friends.json').then(function(response) {
return response.data;
});