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 | |
echo ''; /* sdfds */ echo ''; ;; ! phpMagic(); // echo $i; ?> <?php | |
;;; +phpMagic(); // $increment with 1; | |
@phpMagic(); // $increment with 1; | |
/* $decrement with 1 ;;; */-phpMagic();// $decrement with 1; | |
/* comment ;;; */ \phpMagic(); /* another comment ;;; */ \phpMagic(); // $decrement with 1; | |
function phpMagic() { | |
$poped = array_pop(debug_backtrace()); | |
$fullLine = file($poped['file'])[$poped['line']-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
# View IP Address | |
myip() { | |
if [ -z "$1" ] || [ "$1" == "--help" ]; then | |
echo "Usage: myip OPTION | |
OPTIONS: | |
--remote displays remote (internet) IP Address | |
--local displays local IP Address(s) | |
--help display this help and exit | |
"; |
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 | |
namespace { | |
// This allow us to configure the behavior of the "global mock" | |
$mockSocketCreate = false; | |
include_once './SomeClass.php'; | |
/*$dummy = new \My\Nice\Namezpace\SomeClass; | |
var_dump($dummy->doSomething());*/ |
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 | |
// Example 1: | |
Event::bind('blog.post.create', array(new BlogTriggers, 'onPostCreate')); | |
// Trigger for Example 1 | |
Event::trigger('blog.post.create', [ | |
'name' => 'My 123rd Post on Blog', | |
'id' => '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
<?php | |
// replace ahsanyousuf with your users | |
$dbPath = '/Users/ahsan/Library/Application Support/Skype/ahsanyousuf/main.db'; | |
$db = new PDO( 'sqlite:' . $dbPath ); | |
$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); | |
$query = 'SELECT id, author, dialog_partner, body_xml, timestamp, datetime( timestamp, \'unixepoch\', \'localtime\') as actualTime | |
FROM Messages | |
ORDER BY timestamp DESC |
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 http = require('http'); | |
http.createServer(function (request, response) { | |
var status = request.url.substr(1); | |
if ( ! http.STATUS_CODES[status]) { | |
status = '404'; | |
} | |
response.writeHead(status, { 'Content-Type': 'text/plain' }); |
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
/* | |
* Reference: https://css-tricks.com/findingfixing-unintended-body-overflow/ | |
* Uses: Run it on console.. | |
*/ | |
var docWidth = document.documentElement.offsetWidth; | |
[].forEach.call( | |
document.querySelectorAll('*'), | |
function(el) { |
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 | |
/*/ | |
// To un-comment whole block, just prepend with slash on line above | |
echo 'code'; | |
//*/ |
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
<snippet> | |
<content><![CDATA[<?${TM_PHP_OPEN_TAG_WITH_ECHO:php echo} $1; ?>]]></content> | |
<tabTrigger>php_echo</tabTrigger> | |
<scope>string.quoted.double, string.quoted.single, punctuation.definition.tag.begin.html, text.html, punctuator.definition.string.end.html</scope> | |
<description>PHP tags with echo Code</description> | |
</snippet> |
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 | |
print_r( array_diff_key( get_defined_vars(), array_flip(array('_GET','_SERVER','_POST','_COOKIE','_FILES'))) ); |