Skip to content

Instantly share code, notes, and snippets.

<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>
'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
'use strict';
var CreateCtrl = function(List) {
this.List = List;
this.list = new List();
};
angular.extend(CreateCtrl.prototype, {
create: function(list, lists) {
<script>
// inject inlined constants
angular.module('app.constants', [])
.constant('contextPath', '${pageContext.request.contextPath}');
</script>
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) ->
'use strict';
var app = angular.module('angularjsTddRecipesApp');
var CommentsCtrl = function($scope, loadComments) {
$scope.load = function() {
var promise = loadComments();
promise.then(function(response) {
@lucassus
lucassus / pull_request.rb
Created March 13, 2014 13:14
Creates pull request from the current local branch
#!/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
_.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;
/**
* __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
<!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 />