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
todoApp.directive('ngEnter', function() { | |
return function(scope, element, attrs) { | |
element.bind("keydown keypress", function(event) { | |
if(event.which === 13) { | |
scope.$apply(function(){ | |
scope.$eval(attrs.ngEnter); | |
}); | |
event.preventDefault(); | |
} |
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
todoApp.directive('ngFocus', function ngFocus($timeout) { | |
return function (scope, elem, attrs) { | |
scope.$watch(attrs.ngFocus, function (newVal) { | |
if (newVal) { | |
$timeout(function () { | |
elem[0].focus(); | |
}, 0, false); | |
} | |
}); | |
}; |
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
todoApp.directive('ngBlur',function(){ | |
return function(scope,elem,attr){ | |
elem.bind('blur',function(){ | |
scope.$apply(attr.ngBlur); | |
}); | |
}; | |
}); |
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
directives.auth = function($compile, $http){ | |
return { | |
restrict: 'E', | |
scope: { | |
login: '&', | |
logout: '&', | |
authed: '@' | |
}, | |
link: function(scope, ele, attrs) { | |
var templateurl = { |
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
var filters = {}; | |
/* Usage: ng-bind-html="object.content | trustAsHtml" | |
* | |
* used to fix $sce not scure error when using "ng-bind-html" | |
*/ | |
filters.trustAsHtml = function($sce) { | |
return function (input) { | |
return $sce.trustAsHtml(input); | |
} |
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
var nocomment = function(str) { | |
var div = document.createElement('div') | |
, inline = /([^\\])\/\/[^\n]*(\n?)/g | |
, reg = /\/[^\/]*\/g?m?i?[^\*]?/g | |
, commentLikeReg = /\/\\\/\*[^\/]*\*\//g | |
, string = new RegExp('(\'[^\']*\')|("[^"]*")','g') | |
, identifier = 'SOFISH_S_METHOD_TO_REMOVE_JS_COMMENTS_' | |
, matches = [] | |
, counter = 0 | |
, strReplace; |
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
/* | |
* styleRegTest.js | |
* Copyright (C) 2013 <@TJFDFS> | |
* | |
* Distributed under terms of the MIT license. | |
*/ | |
describe("style regular matching test", function(){ | |
// Test "div#abc.read-more" | |
var pattern = "((div)+|(\\.read-more)+|(#abc)+|(:\\w+)+)\\s*(((?=,)(.*))|$)"; |
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
/*jslint browser: true, devel: true */ | |
(function () { | |
'use strict'; | |
requirejs.config({ | |
baseUrl: ".", | |
paths: { | |
// libraries path | |
"json": "vendor/json2", |
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
/*! | |
* jquery.addrule.js 0.0.2 - https://gist.github.com/yckart/5563717/ | |
* Add css-rules to an existing stylesheet. | |
* | |
* @see http://stackoverflow.com/a/16507264/1250044 | |
* | |
* Copyright (c) 2013 Yannick Albert (http://yckart.com) | |
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). | |
* 2013/11/23 | |
**/ |
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
var x = [ | |
{date:"2013-01-01",sales:99},{date:"2013-01-02",sales:99},{date:"2013-01-03",sales:99},{date:"2013-01-04",sales:99}, | |
{date:"2013-02-01",sales:99},{date:"2013-02-02",sales:99},{date:"2013-02-03",sales:99},{date:"2013-02-04",sales:99}, | |
{date:"2013-03-01",sales:99},{date:"2013-03-02",sales:98},{date:"2013-03-03",sales:99},{date:"2013-03-04",sales:99}, | |
{date:"2013-04-01",sales:99},{date:"2013-04-02",sales:99},{date:"2013-04-03",sales:99},{date:"2013-04-04",sales:99}, | |
{date:"2013-05-01",sales:98},{date:"2013-05-02",sales:99},{date:"2013-05-03",sales:99},{date:"2013-05-04",sales:99}, | |
]; | |
function groupBy(arr, property, cb) { | |
var newArr = [], group = {}, k; |
OlderNewer