Skip to content

Instantly share code, notes, and snippets.

Avatar

Philip Klauzinski pklauzinski

View GitHub Profile
@pklauzinski
pklauzinski / sumTwoMatch.js
Last active Nov 28, 2016
Returns true if any two numbers in given array add up to given integer. This was a "live" coding question I was given in an interview.
View sumTwoMatch.js
/**
* Returns true if any two numbers in list add up to num
*/
function sumTwoMatch(list, num) {
var i = 0,
match = false,
list2;
for (; i < list.length; i++) {
list2 = list.slice();
@pklauzinski
pklauzinski / jquery.icontains.js
Created Jun 24, 2015
Custom jQuery :icontains selector for finding element based on text in a page, case-insensitive
View jquery.icontains.js
/**
* Example use:
* $('div:icontains("Text in page")');
* Will return jQuery object containing any/all of the following:
* <div>text in page</div>
* <div>TEXT in PAGE</div>
* <div>Text in page</div>
*/
$.expr[':'].icontains = $.expr.createPseudo(function(text) {
return function(e) {
You can’t perform that action at this time.