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 search = window.location.search // ?param1=value1¶m2=value2 | |
search?JSON.parse('{"' + search.replace(/\?/g, '').replace(/&/g, '","').replace(/=/g,'":"') + '"}', | |
function(key, value) { return key===""?value:decodeURIComponent(value) }):{}; |
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
/* params = {paramOne: '1', paramTwo: '2'} */ | |
var str = Object.keys(params).map(function(key) { | |
return key + '=' + encodeURIComponent(params[key]); | |
}).join('&'); |
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 getRandomColor() { | |
var letters = '012345'.split(''); | |
var color = '#'; | |
color += letters[Math.round(Math.random() * 5)]; | |
letters = '0123456789ABCDEF'.split(''); | |
for (var i = 0; i < 5; i++ ) { | |
color += letters[Math.round(Math.random() * 15)]; | |
} | |
return color; | |
} |
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
// usage | |
// var thisThing = localStores.getItem('this thing); | |
.run(function ($window) { | |
function supports_html5_storage() { | |
try { | |
return 'localStorage' in window && window['localStorage'] !== null; | |
} catch (e) { | |
return false; | |
} |
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
'use strict'; | |
/* config provide */ | |
/* ignores unhandled rejection for cancelled in Angular 1.6 */ | |
/* */ | |
/* http requests middleware service */ | |
/* if no groupingId is specified, each req is a duplicate by default */ | |
/* usage: */ | |
/* httpQueueService.add(useThisFunction, {timeout: 1000, groupingId:'myCustomQueue'}); */ | |
/* usage with params: */ | |
/* httpQueueService.add(function(){updateCart(product,qty),{timeout:300, groupingId:'cart'}} */ |
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 updateMDL() { | |
$timeout(function () { | |
componentHandler.upgradeAllRegistered(); | |
}, 300); | |
} |
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 film = this.props.data.slice(0, 5).map((item) => { | |
return <FilmItem key={item.id} film={item} /> | |
}); | |
return film; |
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
// usage: | |
// <form ng-form-commit action="/" name='payForm' method="post" target="_top"> | |
// <input type="hidden" name="currency_code" value="USD"> | |
// <button type='button' ng-click='save(payForm)'>buy</button> | |
// </form> | |
.directive("ngFormCommit", [function(){ | |
return { | |
require:"form", | |
link: function($scope, $el, $attr, $form) { |
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
[ | |
{ | |
"name": "KC60 Map" | |
}, | |
[ | |
"Esc", | |
"!\n1", | |
"@\n2", | |
"#\n3", | |
"$\n4", |
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
// In app.js or main.js or whatever: | |
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']); | |
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17). | |
myApp.filter('percentage', ['$filter', function ($filter) { | |
return function (input, decimals) { | |
return $filter('number')(input * 100, decimals) + '%'; | |
}; | |
}]); |