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
anglar.module('myApp',['ui']).config(["$provide", function($provide) { | |
return $provide.decorator("$http", ["$delegate", function($delegate) { | |
var get = $delegate.get; | |
$delegate.get = function(url, config) { | |
// Check is to avoid breaking AngularUI ui-bootstrap-tpls.js: "template/accordion/accordion-group.html" | |
if (!~url.indexOf('template/')) { | |
// Append ?v=[cacheBustVersion] to url | |
url += (url.indexOf("?") === -1 ? "?" : "&"); | |
url += "v=" + cacheBustVersion; | |
} |
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
/** | |
* @ngdoc Directive | |
* @name defaultValue | |
* @restrict 'A' | |
* @element ANY | |
* @author Mohan Singh ( gmail::mslogicmaster@gmail.com, skype :: mohan.singh42 ) | |
**/ | |
(function () { | |
'use strict'; | |
angular |
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
/** | |
* @ngdoc Directive | |
* @name app.directive.detectViewPort | |
* @module app | |
* | |
* @description | |
* detectViewPort staring component with star | |
* @TODO | |
* onDetectViewPort callback | |
* @author Mohan Singh ( gmail::mslogicmaster@gmail.com, skype :: mohan.singh42 ) |
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
/* Checks if localStorage exists on the browser, if not, creates a JSONFallbackStorage object where all the data will be stored. Also creates the localStorage methods so you won't need to change anything on your script. Just remember to send the data on JSONFallbackStore to the server. */ | |
(function(window, undefined){ | |
if (typeof(localStorage) === undefined) { | |
JSONFallbackStore = {}; | |
window.localStorage = { | |
getItem: function(key){ | |
return JSONFallbackStore[key]; | |
}, | |
setItem: function(key, 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
/******************************* | |
* MODAL AS LEFT/RIGHT SIDEBAR | |
* Add "left" or "right" in modal parent div, after class="modal". | |
* Get free snippets on bootpen.com | |
*******************************/ | |
.modal.left .modal-dialog, | |
.modal.right .modal-dialog { | |
position: fixed; | |
margin: auto; |
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
//@bind, apply, call in javascript | |
//@description | |
//@Question: If you want to use an arbitrary object as value of this, how will you do that? | |
/*********** | |
Answer: There are at least three different ways to doing this by using bind, call and apply. | |
For example, I have a method named deductMontlyFee in the object monika | |
and by default value of this would be monika inside the method. | |
************/ | |
/*********** | |
If I bind the deductMontlyFee of monika with another object vikas |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>HMAC-SHA256 Example</title> | |
</head> | |
<body> | |
<script src="http://crypto.stanford.edu/sjcl/sjcl.js"></script> | |
<script> | |
var sharedSecret, query, signature, hmac, xhr; |
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
$resource('/path/to/api/resource', null, { | |
upload: { | |
method: 'POST', | |
headers: { 'Content-Type': undefined }, | |
transformRequest: function (data) { | |
var formData = new FormData(); | |
formData.append("data", angular.toJson(data.model)); | |
angular.forEach(data.files, function (fileData) { |
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
/* These are technically the same, but use both */ | |
overflow-wrap: break-word; | |
word-wrap: break-word; | |
-ms-word-break: break-all; | |
/* This is the dangerous one in WebKit, as it breaks things wherever */ | |
word-break: break-all; | |
/* Instead use this non-standard one: */ | |
word-break: break-word; |
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
angular.directive('autoFocus', function(){ | |
return function(scope, element){ | |
element[0].focus(); | |
}; | |
}); | |
/* | |
<div> | |
<input type="text" auto-focus /> |
OlderNewer