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 highlightTextInDomNode = function(text, targetNode, highlightColor) { | |
// summary: | |
// This function takes any domNode, and highlight given text. | |
// text: String | |
// Text to highlight | |
// domNode: domNode | |
// DomNode to search text | |
if(!text || !targetNode) { | |
return; | |
} |
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
/* | |
Sample usage: | |
node ./index.js port=80 pathToServe=../frontend/_public_prod | |
*/ | |
require('es6-shim'); // Object.assign needs es6 | |
var parseArgv = function(options, argv) { | |
argv || (argv = Array.prototype.slice.call(process.argv, 2)); | |
var result = {}; |
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 getNested = function(object, nestedKeys, separator) { | |
// summary: | |
// `obj.data.nested.callback()` throws error, when some of parent objects aren't available | |
// `if(obj && obj.data && obj.data.nested && obj.data.nested.callbac) { obj.data.nested.callbac() }` is ugly. | |
// object: Object | |
// Object to seek in | |
// nestedKeys: String | |
// Path for obj | |
// example: | |
// getNested(obj, 'you.better.stahp'); |
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 lookForText = "rocess for the production of a fine chemical"; | |
var send = XMLHttpRequest.prototype.send; | |
var transferComplete = function (e) { | |
var text = e.responseText || e.target.responseText; | |
var url = e.responseURL || e.target.responseURL; | |
if(text && text.indexOf(lookForText) !== -1) { | |
console.info("|FOUND IT!|", e, url); | |
} else { | |
console.info("|Looking for it...|", e); |
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
// 10% page loads, flip random element vertically | |
if (Math.random() < 0.1) { | |
var all = document.body.querySelectorAll('*'); | |
all[parseInt(Math.random()*all.length, 10)].style.transform = 'rotate(180deg)' | |
} |
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
// ==UserScript== | |
// @name Aero2: Go to captcha and redirect to router | |
// @namespace aero2 | |
// @include http://bdi.free.aero2.net.pl:8080/ | |
// @version 1 | |
// @grant none | |
var __routerUsername = 'admin'; | |
var __routerPassword = 'password'; |
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
# same as git branch -l but sorts by date | |
git config --global alias.bl "for-each-ref --sort=-committerdate refs/heads/" | |
git config --global alias.cb "checkout --track -b" | |
# make sure if you use ", not ' | |
# to be continued |
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
$($0 || 'body').find('input[type=text], input[type=text], textarea,input[type=password]').filter(':visible').each(function(){ | |
if( $(this).attr('type')==='password' ) | |
return $(this).val('12345678'); | |
if( $(this).attr('id')==='email' || $(this).attr('name')==='email' ) | |
return $(this).val('some@email.com'); | |
if( $(this).attr('name') == 'cvv2' ) | |
return $(this).val('123'); | |
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
echo @dir /O:G %* > ls.bat | |
copy /A ls.bat ll.bat | |
echo C:\wamp\bin\php\php5.3.13\php.exe %* > php.bat | |
echo php "C:\wamp\bin\php\php5.3.13\composer.phar" %* > composer.bat | |
echo ipconfig | find "Adres IPv4" > myip.bat | |
echo @for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i > whereis.bat |
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
jQuery.fn.loadSerializedData = function(data) | |
{ | |
var dataObj = {}, | |
keyValPair; | |
data = data.split('&'); | |
for (var i = 0, length = data.length; i < length; i++) { | |
keyValPair = data[i].split('='); | |
dataObj[decodeURIComponent(keyValPair[0])] = decodeURIComponent(keyValPair[1]); | |
} | |