Skip to content

Instantly share code, notes, and snippets.

View Chukatuk's full-sized avatar

Alex Leibowich Chukatuk

  • Haifa,Israel
View GitHub Profile
@Chukatuk
Chukatuk / debug.php
Last active January 9, 2017 09:14
php debug to console log
function debug ($data) {
echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}";
$output = explode("\n", print_r($data, true));
foreach ($output as $line) {
if (trim($line)) {
$line = addslashes($line);
echo "console.log(\"{$line}\");";
}
}
echo "\r\n//]]>\r\n</script>";
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
$.each($('.element'), function(i, el){
setTimeout(function(){
$(el).removeClass('hidden')
},0 + ( i * 300 ));
});
@Chukatuk
Chukatuk / getMenuHierarchically.php
Last active April 20, 2017 13:07 — forked from vwasteels/getMenuHierarchically.md
Retrieve menu items hierarchically in Wordpress
```php
/**
* Get Menu Items From Location
*
* @param $location : location slug given as key in register_nav_menus
*/
function getMenuItemsFromLocation($location) {
$theme_locations = get_nav_menu_locations();
@Chukatuk
Chukatuk / print.js
Created May 22, 2016 10:24
Print a specific DIV with custom page style
$('.print').click(function(){
var div = $('.entry').html();
var title = $('h1').text();
console.log();
var mywindow = window.open('', '', 'height=800,width=1000');
mywindow.document.write('<html><head><title>'+title+'</title>');
mywindow.document.write('<style></style>');
mywindow.document.write('</head><body >');
mywindow.document.write(div);
mywindow.document.write('</body></html>');