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
a.substring(0,139).match(/[\s\S]+\s/g)[0].trim() |
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(){ | |
var customClickTouchStartEventList = "touchstart.customClick MSPointerDown.customClick pointerdown.customClick"; | |
var customClickTouchEndEventList = "touchend.customClick MSPointerUp.customClick pointerup.customClick"; | |
var customClickActiveGrpAttr = "data-activegrp"; | |
var customClickActiveAttr = "data-active"; | |
var customClickTimeoutAttr = "data-timeout"; | |
/** | |
* Custom click plugin that solves two issues | |
* 1. Remove the 300ms delay present for click event in touch devices. | |
* 2. Provide indicators on every click. |
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
$("iframe").contents().find("a").attr("target","_blank"); |
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 is pretty simple.Just pass an object containing all the attributes you want to set as important. | |
e.g $("#i1").setFixedStyle({"width":"50px","height":""}); | |
There are two additional options. | |
1.To just add important parameter to already present style attribute pass empty string. | |
2.To add important param for all attributes present dont pass anything. It will set all attributes as important. |
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
window.onload = function(){ | |
var startPosX=0,startPosY=0; | |
var elements = $("tapHighlightJS"); | |
for(var i=0;i<elements.length;i++){ | |
var el = $(elements[i]); | |
el.bind('touchstart', function(ev){ | |
var touchobj = ev.originalEvent.changedTouches[0]; | |
startPosX = touchobj.pageX; | |
startPosY = touchobj.pageY; | |
}).bind('touchend', function(ev){ |
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
$.fn.isonscreen = function(context){ | |
debugger; | |
var | |
//Subtract the offset of the parent container. | |
//Will be 0 in case cont is undefined | |
tominus=0, | |
//Add the scrollTop position incase no cont is undefined. | |
toadd=0; | |
if(context){ | |
//Find if the div is itself visible |
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 getPrefix(prop, context) { | |
var vendorPrefixes = ['moz', 'webkit', 'khtml', 'o', 'ms'], | |
upper = prop.charAt(0).toUpperCase() + prop.slice(1), | |
pref, len = vendorPrefixes.length, | |
q = null; | |
while (len--) { | |
q = vendorPrefixes[len]; | |
if (context.toString().indexOf('style')) { | |
q = q.charAt(0).toUpperCase() + q.slice(1); | |
} |
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
// You have L, a list containing some digits (0 to 9). Write a function answer(L) which finds the largest number that can be made from some or all of these digits and is divisible by 3. If it is not possible to make such a number, return 0 as the answer. L will contain anywhere from 1 to 9 digits. The same digit may appear multiple times in the list, but each element in the list may only be used once. | |
var a = [3,1,4,1,5,9]; | |
var max = 0; | |
var pattern = function(arr){ | |
if(arr.length==1){ | |
return arr; | |
} | |
var patterns = []; |
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
//Solution to problem here - http://practice.geeksforgeeks.org/problems/max-absolute-difference/0 | |
var findCombination = function(arr){ | |
debugger; | |
var comb = []; | |
if(arr.length>1){ | |
comb.push(arr); | |
comb = comb.concat(findCombination(arr.slice(1,arr.length))); | |
comb = comb.concat(findCombination(arr.slice(0,arr.length-1))); | |
return comb; | |
}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
//Solution to problem here - http://practice.geeksforgeeks.org/problems/max-absolute-difference/0 | |
var findCombination = function(arr){ | |
debugger; | |
var comb = []; | |
if(arr.length>1){ | |
comb.push(arr); | |
comb = comb.concat(findCombination(arr.slice(1,arr.length))); | |
comb = comb.concat(findCombination(arr.slice(0,arr.length-1))); | |
return comb; | |
}else{ |
OlderNewer