Skip to content

Instantly share code, notes, and snippets.

View gubi's full-sized avatar

Alessandro Gubitosi gubi

View GitHub Profile
categories: {
"Technology",
"Finance",
"Justice",
"Culture",
"Art",
"Education",
"Science",
"Nature",
"Live",
<!-- Begin -->
<?php
$menu_name = 'primary';
$locations = get_nav_menu_locations();
$menu = wp_get_nav_menu_object($locations[$menu_name]);
$menuitems = wp_get_nav_menu_items($menu->term_id, array('order' => 'DESC'));
?>
<?php
$count = 0;
<?php
function explodeTree($array, $delimiter = "_", $baseval = false) {
if(!is_array($array)) return false;
$splitRE = "/" . preg_quote($delimiter, "/") . "/";
$returnArr = array();
foreach ($array as $key => $val) {
// Get parent parts and the current leaf
$parts = preg_split($splitRE, $key, -1, PREG_SPLIT_NO_EMPTY);
$leafPart = array_pop($parts);
@gubi
gubi / menuhead.html.twig
Last active August 29, 2015 13:57
Temp backup of enhanced menu with bootstrap dropdown (path: /Library/WebServer/Sites/pgrdg.grinfo.net/app/Resources/views)
<style>
.menu_level{float: right; width: 100%; list-style: none; background-color: #1E1E1E; padding: 5px; margin: 0px;}
.menu_level li {/*float: left; background-color: #1E1E1E;*/ margin-left: 10px;}
.menu_level li a{text-decoration: none; color: #fff; font-weight: bold; padding: 5px;}
#menu_opener{width: 100%; text-align: right; border-top: 2px solid #1E1E1E; color: #fff; cursor: pointer;}
#menu_opener span{ background-color: #1E1E1E; padding: 5px 20px;}
#menu_opener span:hover{ background-color: #1a1a1a;}
#menu a { padding: 5px; }
#menu li.menu_desc { padding: 5px 5px 5px 0; }
@gubi
gubi / calculate_altitude.js
Created March 30, 2014 13:23
Earth tools
$.get("http://www.earthtools.org/height/" + LATITUDE + "/" + LONGITUDE, function(heightdata) {
var xml = heightdata,
xmlDoc = $.parseXML(xml),
$xml = $(xmlDoc),
$height_mt = $xml.find("meters"),
$height_ft = $xml.find("feet");
console.log("Metri: " + $height_mt.text(), "Piedi: " + $height_ft.text());
});
@gubi
gubi / search_count_result.json
Created May 20, 2014 07:59
First PGRDG search
{
"status": {
"state": "ok"
},
"paging": {
"affected": 9,
"actual": 9,
"skipped": 0,
"limit": 50
},
{
paging: {
step: 50,
total: 3,
},
table: {
params: {
description_tooltip: "true",
filter_addon: "false",
paging_buttons: {
@gubi
gubi / Atom_packages.md
Last active May 13, 2022 13:20
Packages installed in Atom

Featured

  • Autocomplete
  • Autocomplete Plus
  • Zen
  • Color Picker
  • Linter
  • Linter Php
  • Linter csslint
  • Linter Jshint
  • Linter Jsonlint
@gubi
gubi / api.js
Last active August 29, 2015 14:03
PGRD definitions lists
// See http://localhost/API/?definitions=api&keep_update=true
// to get the last updated version from Milko's commit
var kAPI_REQUEST_OPERATION = "op";
var kAPI_REQUEST_LANGUAGE = "lang";
var kAPI_REQUEST_PARAMETERS = "param";
var kAPI_RESPONSE_STATUS = "status";
var kAPI_RESPONSE_PAGING = "paging";
var kAPI_RESPONSE_REQUEST = "request";
var kAPI_RESPONSE_RESULTS = "results";
<?php
/*=======================================================================================
* FORMATTED RESPONSE PARAMETERS *
*======================================================================================*/
/**
* Property type (string).
*
* This tag indicates the type of the formatted property, it indicates how the
* {@link kAPI_PARAM_RESPONSE_FRMT_DISP} is structured and whether to expect additional