Skip to content

Instantly share code, notes, and snippets.

Chris binaryreverse

Block or report user

Report or block binaryreverse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@binaryreverse
binaryreverse / data_attribute_checker.js
Last active Jun 13, 2016
Check each element in a nested structure (like a slider) for a specific data attribute and mark these elements visually witha red background (Q&D)
View data_attribute_checker.js
$('.my-outer-container').find('.my-element').each(function() {
if(typeof $(this).data('my-datakey') === 'undefined') {
$(this).css('background', '#FF0000');
}
});
@binaryreverse
binaryreverse / get_unix_ts_seconds.bash
Created May 31, 2016
Get Unix timestamp in seconds since Unix epoch
@binaryreverse
binaryreverse / curl_fetch_url_content.php
Last active May 25, 2016
PHP fetch content from URL alternative with curl (instead of file_get_contents)
View curl_fetch_url_content.php
$url = 'http://xxxxxxxxxx.tld';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
@binaryreverse
binaryreverse / xdebug_disable_limits.php
Created May 24, 2016
Disable Xdebug var_dump limitations
View xdebug_disable_limits.php
ini_set('xdebug.var_display_max_depth', -1);
ini_set('xdebug.var_display_max_children', -1);
ini_set('xdebug.var_display_max_data', -1);
@binaryreverse
binaryreverse / check_array_not_empty.js
Created Apr 14, 2016
Check JS Array for value and not empty
View check_array_not_empty.js
if (typeof array[index] !== 'undefined' && array[index] !== null) {
}
//shortened to...
if (array[index] != null) {
// The == and != operator consider null equal to only null or undefined
}
@binaryreverse
binaryreverse / dummy_console_log.js
Created Mar 31, 2016
Dummy console.log() for Browsers with non active Debugging tools. This prevents console errors in production code.
View dummy_console_log.js
if(typeof console === 'undefined') {
console = { log: function() { } };
}
@binaryreverse
binaryreverse / new_tmux_window_pstorm.bash
Last active May 24, 2016
New tmux window with PHP Storm started from param
View new_tmux_window_pstorm.bash
tmux new-window -n pstorm pstorm
@binaryreverse
binaryreverse / empty_zend_cache.bash
Last active May 24, 2016
Empty local Zend cache
View empty_zend_cache.bash
sudo rm -rf /var/www/html/portale/data/cache/pages/*
sudo rm -rf /var/www/html/portale/data/cache/metadata/*
View install_update_rust.bash
curl -sSf https://static.rust-lang.org/rustup.sh | sh
@binaryreverse
binaryreverse / js_object_inspect.js
Created Mar 15, 2016
JS Object inspection (Q&D)
View js_object_inspect.js
function objInspect(o, i) {
if(typeof i == 'undefined') {
i = '';
}
if(i.length > 50) {
return '[MAX ITERATIONS]';
}
var r = [];
for(var p in o) {
var t = typeof o[p];
You can’t perform that action at this time.