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
function getviewport() { | |
var win = window, | |
matchMediaSupported = (win.matchMedia || win.msMatchMedia), | |
viewport; | |
if (matchMediaSupported) { | |
if (win.matchMedia('screen and (min-width: 641px)').matches) { | |
viewport = 'large'; | |
} else { | |
viewport = 'small'; |
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
var urlDomain = window.location.hostname.replace('www.', ''); | |
app.config('$sceDelegateProvider', function($sceDelegateProvider) { | |
$sceDelegateProvider.resourceUrlWhitelist([ | |
'self', | |
'http://*.' + urlDomain + '/**' | |
]); | |
}); |
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
// Define a class like this | |
function Person(name, gender) { | |
// Add object properties like this | |
this.name = name; | |
this.gender = gender; | |
} | |
// Add methods like this. All Person objects will be able to invoke this | |
Person.prototype.speak = function() { | |
alert('Howdy, my name is ' + this.name); |
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
grunt.registerTask('beep', 'beep!', function() { grunt.log.writeln('\x07').ok(); }); // beep! |
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
// Define an object with init function and add methods | |
var Person = { | |
init: function(name, gender) { | |
this.name = name; | |
this.gender = gender; | |
}, | |
speak: function() { | |
alert('Howdy, my name is ' + this.name); | |
} | |
}; |
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
$scope.orderByValue = function(value) { | |
return value; | |
} | |
// usage: ng-repeat="item in items | orderBy:orderByValue" |
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
myApp.filter('noWidows',function(){ | |
return function(input){ | |
var wordArray = input.split(' '); | |
if (wordArray.length > 1) { | |
wordArray[wordArray.length - 2] += ' ' + wordArray[wordArray.length - 1]; | |
wordArray.pop(); | |
return wordArray.join(' '); | |
} else { |
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
// Firefox uses HTML, Webkit uses body, iOS uses pageYOffset, therefore check for any: | |
var scrollPosition = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset; |
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
/*-- Media query variables --*/ | |
$mq-small: 'media and (max-width: 767px)'; | |
$mq-large: 'media and (min-width: 768px)'; | |
/*-- Media query mixin --*/ | |
@mixin mq($mqString) { | |
@media #{$mqString} { | |
@content; |
OlderNewer