Skip to content

Instantly share code, notes, and snippets.

@sercomi
sercomi / notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes.yaml Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
blueprint:
name: Appliance has finished
description: Do something when an appliance (like a washing machine or dishwasher)
has finished as detected by a power sensor.
domain: automation
input:
power_sensor:
name: Power Sensor
description: Power sensor entity (e.g. from a smart plug device).
selector:
@sercomi
sercomi / low-battery-level-detection-notification-for-all-battery-sensors.yaml Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@sercomi
sercomi / gist:2359452
Created April 11, 2012 13:55
PHP: Get directory list files
/**
* Obtiene la lista de archivos del directorio especificado
* @param string $directory
* @return array listado de archivos
*/
function getDirectoryList ($directory)
{
// create an array to hold directory list
$results = array();
@sercomi
sercomi / index.php
Created March 30, 2012 07:42
WP: List Cronjobs in the footer
<?php
/*
Plugin Name: WP Cron Jobs
Plugin URI: https://github.com/franz-josef-kaiser
Description: List WordPress internal cron jobs (array data) in the footer. The hook 'wp_footer()' must be present in your theme.
Author: Franz Josef Kaiser
Author URI: https://github.com/franz-josef-kaiser
Version: 0.1
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@sercomi
sercomi / gist:2248792
Created March 30, 2012 07:32
WP: Cron jobs
//Crear un nuevo temporizador
add_filter('cron_schedules', 'add_scheduled_interval');
// Anyade nuevos intervalos a wp_schedules
function add_scheduled_interval($schedules)
{
$schedules['minutes_1'] = array('interval'=>60, 'display'=>'Once 1 minutes');
$schedules['minutes_30'] = array('interval'=>30, 'display'=>'Once 30 minutes');
return $schedules;
}
@sercomi
sercomi / sidebar.php
Created March 26, 2012 15:16
WP: Setup widgets sidebar
<?php
/**
* The sidebar file.
*
* @package WordPress
*/
register_sidebar(array(
'name' => 'Main sidebar',
'id' => 'main-sidebar',
@sercomi
sercomi / theme-setup.php
Created March 26, 2012 15:10
WP: Theme setup function
<?php
/**
* Theme setup.
*
* @package WordPress
*/
function theme_setup()
{
@sercomi
sercomi / gist:2205296
Created March 26, 2012 14:03
WP: Pages titles
<title><?php
if (is_home () || is_front_page() ) {
bloginfo('name');
} elseif ( is_category() ) {
single_cat_title(); echo ' - ' ;
bloginfo('name');
} elseif (is_single() ) {
single_post_title();
} elseif (is_page() ) {
bloginfo('name');
@sercomi
sercomi / gist:2204531
Created March 26, 2012 11:34
WP: Theme development style.css
/*
Theme Name: [Theme name]
Theme URI: [Theme url]
Description: [Theme description]
Author: [Theme author]
Author URI: [Author URL]
Version: 1.0
Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)
License: