This file contains 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
angular.module("alert-directive", []) | |
.directive('alert', function () { | |
return { | |
restrict: 'EA', // support to be used as an element or an attribute | |
replace: true, // tells the compiler to replace the original directive's element with the template given by the template field | |
template: '<div class="alert alert-{{type || \'info\'}}">' + | |
'<button type="button" class="close" ng-click="close()">×</button>' + | |
'<div ng-transclude></div>' + // the ng-transclude directive gets the transcluded elements and appends them to the element in the template on which it appears | |
'</div>', |
This file contains 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
angular.module('app', ['alert-directive']) | |
.controller('AlertController', function ($scope) { | |
$scope.alerts = [ | |
{ type: 'error', msg: 'Oh snap! Something went wrong.' }, | |
{ type: 'success', msg: 'Well done! It worked out in the end.' } | |
]; | |
$scope.addAlert = function () { | |
$scope.alerts.push({msg: "Watch out - another alert!"}); |
This file contains 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 | |
# Install Nginx and config Google ghs proxy, tested on Amazon EC2 Linux | |
# You need first to add a domain A record point ghs to the server which runs Nginx | |
# and then alias sub-domain to ghs.your_domain_name | |
# Author: Yuan XU | |
# Version: 0.1 | |
# URL: blog.xuyuan.me | |
if [ -z $1 ]; then | |
echo "Usage: nginx.sh [domain_name]" |
This file contains 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
####################################################################### | |
# | |
# This is the main Nginx configuration file. | |
# | |
# More information about the configuration options is available on | |
# * the English wiki - http://wiki.nginx.org/Main | |
# * the Russian documentation - http://sysoev.ru/nginx/ | |
# | |
####################################################################### |