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
/** | |
* Adjust the resolution by scaling the height and width to fit the current | |
* width and height of the pane. | |
* | |
* @param {string} originalResolution the resolution in object format | |
* @param {string} maxResolutionthe resolution in object format | |
* | |
* @author Mohamed Mansour (http://mohamedmansour.com) | |
*/ | |
var adjustResolution = function(originalResolution, maxResolution) { |
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
Utils = {}; | |
/** | |
* Mediator pattern based on previous work by @rpflorence, depends on underscore :) | |
* | |
* Subscribe to an event: | |
* Utils.mediator.subscribe('FOO', onFoo); | |
* function onFoo(data) {alert(data.bar);}; | |
* | |
* Fire an event: |
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
// Mohamed Mansour 2012 http://mohamedmansour.com | |
var initEvent = function(element, str) { | |
var clickEvent = document.createEvent('MouseEvents'); | |
clickEvent.initEvent(str, true, true); | |
element.dispatchEvent(clickEvent); | |
}; | |
var simulateClick = function(element) { | |
initEvent(element, 'mousedown'); | |
initEvent(element, '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
javascript:(function() { | |
// This is evil. | |
var global = {}; | |
global.unignoredCount = 0; | |
global.IGNORE_DIALOG_SELECTOR = '.Yy.eoTope.b-w.Kz'; | |
global.IGNORE_LINK_SELECTOR = '.k-U-C.k-EoqIId'; | |
global.ACTIONS_DROP_SELECTOR = '.c-wa-Da.b-a.b-a-G.Po4Sz.Vy.c-q-o-a'; | |
global.ACTIONS_IGNORE_SELECTOR = 'div[id=":16"]'; | |
global.LOADING_SELECTOR = '.jb.dp'; | |
global.VALID_URL_NAMESPACE = '^https://plus.google.com/(u/\\d+/)?circles'; |
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
/** | |
* Overrides the Resize Event handler if exists so we can call that resize callback. | |
* This is useful if websites relayout on resize events in case you are changing the | |
* DOM. Or perhaps doing some animations. | |
* | |
* @usage | |
* // Whenever your ready, it is best to inject this at the beginning. | |
* ResizeHijack.inject(); | |
* | |
* // Then you fire the resize event and if that website has any resize it will call it. |
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
// Keep track of the observers so we could clean up. | |
var previousObserver = null; | |
var currentObserver = null; | |
// Observe when the stream panel has changed. In Google+, the streampanel gets | |
// swapped when viewing another stream. It gets added, old one gets removed, and | |
// the new one's visibility is shown. | |
var summaryObserver = new MutationSummary({ | |
callback: handleChanges, | |
queries: [{ element: "div[guidedhelpid='streamcontent']" }] |
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
#!/bin/sh | |
# Mohamed Mansour (http://mohamedmansour.com) | |
if [ $# -ne 1 ]; then | |
echo "Usage: port_checker <port>" | |
exit 1 | |
fi | |
PORT=$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
<?php | |
$ds = @ldap_connect(ldap_host); | |
if ($ds) { | |
$r = @ldap_bind($ds, 'mmansour@DOMAIN', 'bad'); | |
if ($r) { | |
echo "Success"; | |
} | |
else { | |
echo "Failed"; | |
} |
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
#!/usr/bin/python | |
import win32api, win32con | |
import threading | |
class AutoMouseMove(threading.Thread): | |
def __init__(self): | |
threading.Thread.__init__(self) | |
self.event = threading.Event() |
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": "Selected Text", | |
"version": "0.1", | |
"description": "Selected Text", | |
"browser_action": { | |
"default_title": "Selected Text", | |
"default_icon": "icon.png", | |
"default_popup": "popup.html" | |
}, | |
"permissions": [ |