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
<html ng-app="ng-demo-app"> | |
<head> | |
<title>AngularJS simple app demo</title> | |
</head> | |
<body ng-controller="MainCtrl"> | |
<input type="text" ng-model="name" ng-required> | |
<div>{{name}}</div> | |
<div ng-controller="ChildCtrl"> | |
<input type="text" ng-model="salut"> | |
<div>{{salutation}}</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
'use strict'; | |
var app = angular.module('glossaryApp'); | |
app.config(function($provide) { | |
$provide.decorator('$modal', function($delegate) { | |
var open = $delegate.open; | |
// decorate newly created modalInstance with some custom methods |
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
'use strict'; | |
var CreateCtrl = function(List) { | |
this.List = List; | |
this.list = new List(); | |
}; | |
angular.extend(CreateCtrl.prototype, { | |
create: function(list, lists) { |
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
<script> | |
// inject inlined constants | |
angular.module('app.constants', []) | |
.constant('contextPath', '${pageContext.request.contextPath}'); | |
</script> |
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
class @BaseCtrl | |
@register: (app, name) -> | |
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1] | |
app.controller name, this | |
@inject: (annotations...) -> | |
ANNOTATION_REG = /^(\S+)(\s+as\s+(\w+))?$/ | |
@annotations = _.map annotations, (annotation) -> |
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
'use strict'; | |
var app = angular.module('angularjsTddRecipesApp'); | |
var CommentsCtrl = function($scope, loadComments) { | |
$scope.load = function() { | |
var promise = loadComments(); | |
promise.then(function(response) { |
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
#!/usr/bin/env ruby | |
require "optparse" | |
options = Hash.new | |
parser = OptionParser.new do |opts| | |
opts.banner = "Usage: pull_request [options]" | |
opts.on("-i", "--issue=ISSUE", "GitHub issue") do |issue| | |
options[:issue] = issue | |
end |
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
_.mixin({ | |
// Get/set the value of a nested property | |
deep: function (obj, key, value) { | |
var keys = key.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'), | |
root, | |
i = 0, | |
n = keys.length; |
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
/** | |
* __proto__ and prototype | |
* - the __proto__ property the instance's 'parent' up the prototype chain | |
* - the prototype property refers what new instances of the type will have their __proto__ set to, i.e. what will be the new instance's 'parent' up the prototype chain | |
*/ | |
/* Given */ | |
function Object () {} | |
Object.prototype = { | |
__proto__: null |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery.min.js"></script> | |
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" /> | |
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> | |
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"></script> | |
<meta charset=utf-8 /> |