Skip to content

Instantly share code, notes, and snippets.

<h1>Alert</h1>
<p>Bootstrap JS</p>
<div class="alert fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
</div>
<p></p><a ng-click="alert=true">Open Alert (AngularJS)</a></p>
<div class="alert fade" ng-class="{in:alert}">
<button type="button" class="close" ng-click="alert=false">×</button>
/*jshint unused: vars */
require.config({
paths: {
sinon: '../../bower_components/sinon/lib/sinon',
'sass-bootstrap': '../../bower_components/sass-bootstrap/dist/js/bootstrap',
metisMenu: '../../bower_components/metisMenu/dist/metisMenu',
jquery: '../../bower_components/jquery/dist/jquery',
'angular-ui-router': '../../bower_components/angular-ui-router/release/angular-ui-router',
'angular-translate-loader-partial': '../../bower_components/angular-translate-loader-partial/angular-translate-loader-partial',
'angular-translate': '../../bower_components/angular-translate/angular-translate',
app.directive('datepickerLocaldate', ['$parse', function ($parse) {
var directive = {
restrict: 'A',
require: ['ngModel'],
link: link
};
return directive;
function link(scope, element, attr, ctrls) {
var ngModelController = ctrls[0];
app.directive('datepickerLocaldate', ['$parse', function ($parse) {
var directive = {
restrict: 'A',
require: ['ngModel'],
link: link
};
return directive;
function link(scope, element, attr, ctrls) {
var ngModelController = ctrls[0];
@manojjsm
manojjsm / index.html
Last active August 29, 2015 14:16 — forked from anonymous/index.html
<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<meta charset=utf-8 />
<title>Angular multiple select prepopulation</title>
</head>
<body ng-controller="Ctrl">
<select multiple="multiple" ng-model="userRoles" ng-options="r.id as r.name for r in roles"></select>
function diagonalTraverse(m, fn)
{
// This only works for rectangular or square
// form matrices. So no rows of variable sizes!
if ( m && m.length > 0 && m[0].length > 0 )
{
var i = 0, j = 0,
ci = null, cj = null,
M = m[i].length, // # of columns
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@manojjsm
manojjsm / angularjs_directive_attribute_explanation.md
Last active August 29, 2015 14:08 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
private static List<T> RemoveDoubleItems<T>(List<T> list)
{
var newList = new List<T>();
var keyList = new Dictionary<T,string>();
foreach (T item in list)
{
if (!keyList.ContainsKey(item))
{
keyList.Add(item, string.Empty);
public class RelativeGrowthRate : IObservable<int>
{
readonly int hourRate;
readonly TimeSpan duration;
readonly decimal hourIncrease;
public RelativeGrowthRate(int hourRate, TimeSpan duration)
: this(hourRate,
duration,
1.0M)