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
| a { color: red !important; } |
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
| (function () { | |
| var root = $($0); | |
| var watchers = []; | |
| var f = function (element) { | |
| if (element.data().hasOwnProperty('$scope')) { | |
| angular.forEach(element.data().$scope.$$watchers, function (watcher) { | |
| watchers.push(watcher); | |
| }); | |
| } |
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
| // in body ng-controller="MainCtrl as main" | |
| this.app.controller('MainCtrl', function($scope) { | |
| this.first = "willy"; | |
| this.last = "wonka"; | |
| self = this; | |
| $scope.$watch('first + last', function(val) { | |
| self.fullName = self.first + ' ' + self.last | |
| }); | |
| return this; |
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
| /** | |
| * x is a value between 0 and 1, indicating where in the animation you are. | |
| */ | |
| var duScrollDefaultEasing = function (x) { | |
| if(x < 0.5) { | |
| return Math.pow(x*2, 2)/2; | |
| } | |
| return 1-Math.pow((1-x)*2, 2)/2; | |
| }; |
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
| data = { | |
| Users: [ | |
| { name: 'Chris Young', id: 'xchris' } | |
| { name: 'Andrew Hsu', id: 'xandrew' } | |
| { name: 'Grant Lee Crilly', id: 'xgrant' } | |
| { name: 'Michael Natkin' } | |
| { name: 'Huy Nguyen' } | |
| ] | |
| Recipes: [ | |
| { name: 'Sous Vide Steak' } |
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
| $('.message').map(function() { return { author: $(this).find('.nickname').text(), likes: +$(this).find('.likes .count').text() } }) | |
| allGrouped = _.groupBy(all, function(val) { return val.author; }) | |
| fellas = _.map(allGrouped, function(val, key) { | |
| likeTotal = val.map(function(val) { return val.likes; }).reduce(function(a, b) {return a + b;}, 0) | |
| return { | |
| who: key, | |
| likeTotal: likeTotal, | |
| likeAverage: likeTotal / val.length, | |
| messageTotal: val.length | |
| } |
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
| <div ng-if="!imageSrc"> | |
| <filepicker ng-model="imageSrc"></filepicker> | |
| </div> | |
| <div ng-if="imageSrc"> | |
| <display-image image="imageSrc"></display-image> | |
| </div> |
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
| match (comment:Comment {id:'xyz'})<-[:created]-(author:Person) | |
| return extend(comment, { author: author.name }) |
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
| str = "hello [nick] youre a baler [coder] and u [hot] how is this [possible]" | |
| strings = [] // this is an array of all the results | |
| newStr = '' // this is the current string we're keeping | |
| foundLeft = false // are we in a bracket | |
| for i in str | |
| if (i is '[') foundLeft = true | |
| if (i is ']') { | |
| foundLeft = false | |
| strings.push(newStr) | |
| newString = '' |
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
| def extractTags(s): | |
| new = "" | |
| str = [] | |
| foundLeft = False | |
| for letter in s: | |
| if(s == '['): | |
| foundLeft = True | |
| if(s == ']'): | |
| foundLeft = False | |