Skip to content

Instantly share code, notes, and snippets.

View pietromalerba's full-sized avatar

Pietro Malerba pietromalerba

  • M3
  • Civitanova Marche (MC) - Italy
View GitHub Profile
var pageHeight = jQuery(window).height();
var navHeight = pageHeight - 320;
jQuery('#sidebar-a #block-book-navigation').css({max-height: navHeight + 'px; });
/*
* Inspired by:
* http://designedbythomas.co.uk/blog/how-detect-width-web-browser-using-jquery
*
* This script is ideal for getting specific class depending on device width
* for enhanced theming. Media queries are fine in most cases but sometimes
* you want to target a specific JQuery call based on width. This will work
* for that. Be sure to put it first in your script file. Note that you could
* also target the body class instead of 'html' as well.
* Modify as needed
/*
*
* Originally inspired by: http://designedbythomas.co.uk/blog/how-detect-width-web-browser-using-jquery
*
* Original source by https://gist.github.com/highrockmedia/3710930
*
* My contribution: I re-wrote some code it to fire as one function, so you're only editing values in one place.
*
*/
<?
include 'spreadsheet.php';
$Spreadsheet = new Spreadsheet("[email protected]", "password");
$Spreadsheet->
setSpreadsheet("Tester")->
setWorksheet("Sheet1")->
add(array("Header 1" => "Cell 1", "Header 2" => "Cell 2"));
?>
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# This is the free sample of .htaccess from 6GO s.r.l.
# @author Claudio Ludovico Panetta (@Ludo237)
@pietromalerba
pietromalerba / Json-api-ACF.php
Created May 29, 2014 19:00 — forked from diegochavez/Json-api-ACF.php
Wordpres json ACF
add_filter('json_api_encode', 'json_api_encode_acf');
function json_api_encode_acf($response)
{
if (isset($response['posts'])) {
foreach ($response['posts'] as $post) {
json_api_add_acf($post); // Add specs to each post
}
}
@pietromalerba
pietromalerba / remove.php
Last active August 29, 2015 14:06 — forked from craigmdennis/remove.php
Remove menu for specific users
<?php
add_action( 'admin_menu', 'remove_menus' );
function remove_menus() {
global $menu;
global $submenu;
// echo '<pre>';
// print_r($menu);
jQuery.ajax({
url: '/wp-admin/admin-ajax.php',
type: 'GET',//POST, JSON, XML
dataType: 'html',
data: ({
action: 'MY_AJAX_FUNCTION',
state: state,
}),
success: function(data){
if (data){
@pietromalerba
pietromalerba / order_advanced_custom_fields.php
Created September 16, 2014 15:31
Order Fields (advanced custom fields)
<?php
$fields = get_fields();
//echo "<pre>".var_dump($fields)."</pre>";
$scheda_immobile_valori = array();
if( $fields )
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),