This file contains hidden or 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
| /* @ngInject */ | |
| export class MyComponent { | |
| constructor($scope: ng.IScope, $ngRedux: ngRedux.INgRedux) { | |
| const unsubscriber = $ngRedux.connect(state => state.myState)(this); | |
| // disconnect redux on component destroy | |
| $scope.$on('$destroy', unsubscriber); | |
| } | |
| } |
This file contains hidden or 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
| soccerModule.controller('leagueListController', [ | |
| '$scope', | |
| 'selectors', | |
| 'store', | |
| function($scope, selectors, store) { | |
| $scope.$watch(() => selectors.count(store.getState()), count => { | |
| // ... | |
| }); | |
| } | |
| ]); |
This file contains hidden or 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
| const gulp = require('gulp'); | |
| const gutil = require('gulp-util'); | |
| const webpack = require("webpack"); | |
| const WebpackDevServer = require("webpack-dev-server"); | |
| gulp.task("webpack", (callback) => { | |
| const config = require('./webpack.config')('development'); | |
| const compiler = webpack(config); |
This file contains hidden or 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
| #!/bin/bash -e | |
| if [ -z $1 ]; then | |
| echo "skel-hub - download and extract github tarball | |
| Usage: $0 user/repo [project]" | |
| exit 1 | |
| fi | |
| GITHUB_REPO=$1 |
This file contains hidden or 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
| ssh-tmux() { | |
| ssh -t "$@" tmux new-session -A -s main | |
| } | |
| # use it just like usual ssh command, it will immediately run tmux on remote server with session name "main" |
This file contains hidden or 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
| #!/bin/bash | |
| # save this script to setup-docker-volume.sh and chmod to allow executable (chmod +x setup-docker-volume.sh) | |
| # Then add this entry to your crontab (generally at /var/spool/cron/root, /etc/cron.d, /etc/crontab) | |
| # @reboot /path/to/setup-docker-volume.sh | |
| set -e | |
| wait_block() { | |
| printf . |
This file contains hidden or 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
| #!/bin/sh | |
| # first, create overlay network to make all of your nodes can to talk to each others. | |
| docker network create -d overlay mariadb-network | |
| # then, create primary node, make sure you create the service with only 1 replica | |
| docker service create \ | |
| --name mariadb-master \ | |
| --replicas 1 \ | |
| --mount target=/var/lib/mysql,source=/vol/mariadb-master,type=bind \ |
This file contains hidden or 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
| #!/bin/bash | |
| TERM=xterm | |
| PREFIX=/opt/gitlab | |
| SOURCE_DIR=$PREFIX/src | |
| LIB_DIR=$PREFIX/lib | |
| GITLAB_HOME=$PREFIX/home/git | |
| GITLAB_VERSION=8.3.2 | |
| GITLAB_INSTALL_DIR=$GITLAB_HOME/gitlab | |
| GITLAB_SHELL_VERSION=2.6.9 |
This file contains hidden or 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
| #!/bin/bash | |
| DEPS_ROOT=/root | |
| # build tools | |
| yum install gcc make gcc-c++ openssl-devel sqlite-devel readline-devel bzip2-devel tk-devel zlib-devel wget | |
| # libgit2 need python2.7 to build | |
| cd $DEPS_ROOT | |
| wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz |
This file contains hidden or 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
| #!/bin/bash | |
| help() { | |
| echo "\ | |
| Usage: $0 save - save all docker images to current directory | |
| $0 load - find all images in current directory then import to docker" | |
| exit 1 | |
| } | |
| get-image-field() { |