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.manifest = { | |
"name": "Codeskulptor Autosave", | |
"icon": "../../icon48.png", | |
"settings": [ | |
{ | |
"tab": "Main settings", | |
"group": "Frequency settings", | |
"name": "freq", | |
"type": "slider", | |
"label": "Frequency in minutes:", |
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 settings = new Store("settings", { | |
"freq": 3 | |
}); | |
chrome.extension.onRequest.addListener( | |
function(request, sender, sendResponse) { | |
chrome.pageAction.show(sender.tab.id); | |
sendResponse(settings.toObject()); | |
} | |
); |
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
// Paul Irish dissects jQuery's source code and explains some sexy practices and pitfalls. Here's a summary. | |
// This pattern is a self-executing anonymous function. It helps minification, faster scope access to document and eliminates the asshole effect where someone writes undefined = true in your JS | |
(function(window, document, undefined){ | |
/*... code here ...*/ | |
})(this, document); | |
// In short, the self calling pattern is as follows: | |
(function f() {})(); | |
// or with arguments |
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": "DeSkin", | |
"version": "0.9", | |
"manifest_version" : 2, | |
"description": "Hides Vevo ads from around Youtube videos", | |
"background" : { "page" : "background.html" }, | |
"page_action" : | |
{ | |
"default_icon": { | |
"19": "icons/19.png", |
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
chrome.extension.onMessage.addListener( | |
function(request, sender, sendResponse) { | |
chrome.pageAction.show(sender.tab.id); | |
sendResponse({}); | |
}); |
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 the elements that get force-fed ad styles | |
var ids = new Array("watch-headline-show-title", "watch-headline-title", "content"); | |
// Cache the array count to get the fastest looping | |
var idsCount = ids.length; | |
// Loop through every one of those IDs and.. | |
while(idsCount--) { | |
// Fetch the element by current ID | |
var element = document.getElementById(ids[idsCount]); |
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 | |
$aArray = array(); | |
$aArray['someKey']; | |
?> | |
// Notice: Undefined index: someKey in ... |
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
<h1>Operation completed</h1> | |
<?php | |
echo @$this->aMessages['error']; | |
echo '<hr />'; | |
echo $this->aMessages['status']; | |
echo '<hr />'; | |
// ... |
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
// $oView = ... our view object | |
if (/* some expression that signifies an error */) { | |
$aMessages['error'] = 'Error no.2 occurred, contact developer!'; | |
} | |
$aMessages['status'] = 'Finished operation'; | |
$oView->aMessages = $aMessages; |
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 myErrorHandler($errno, $errstr, $errfile, $errline) | |
{ | |
if (!(error_reporting() & $errno)) { | |
// This error code is not included in error_reporting | |
return; | |
} | |
echo "<b>ERROR!</b> [$errno] $errstr<br />\n"; | |
echo " Fatal error on line $errline in file $errfile"; | |
echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; | |
echo "Aborting...<br />\n"; |