Skip to content

Instantly share code, notes, and snippets.

@amdbuilder
amdbuilder / motion_lighting_adv.yaml
Last active February 9, 2023 04:00
Motion Lighting - Advanced
blueprint:
name: Motion Lighting - Advanced
description:
"Turn on a light, switch, scene, script or group based on motion detection,
and low light level.\nThis blueprint uses helper entities you have to create yourself
for some input values, to be able to dynamically set limits. For instructions
on creating the helper entities take a look in the Home Assistant Community forum
topic: https://community.home-assistant.io/t/turn-on-light-switch-scene-or-script-based-on-motion-and-illuminance-more-conditions/257085\n\nRequired
entities:\n - Motion sensor (single sensor or group)\n - Target entity (light,
switch, scene* or script*)\n\n(*) If you select a scene or script as your target_entity,
@amdbuilder
amdbuilder / gist:522c3c79a54cd1c90f7c
Created June 21, 2014 04:41
MODX Performance .htaccess
A few blocks of .htaccess code to help improve your websites performance and/or functionality. I would recommend reading about each section and applying if required instead of applying everything.
The more code in your .htaccess the more your server needs to process BEFORE the HTML starts being served.
______________________ .htaccess starts after this line _________________________________
## Optional - Allow cross-origin requests. ##
# http://enable-cors.org/ - http://www.w3.org/TR/cors/
# https://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
<?php
$eventName = $modx->event->name;
switch ($eventName) {
case 'OnLoadWebDocument' :
$output = $GLOBALS['code_content'] = $modx->resource->get('content');
preg_match_all('/<pre.*?>(.*?)<\/pre>/ims', $output, $matches);
$i = 0;
foreach ($matches[1] as $key => $match) {
$output = str_replace($match, '~*code_' . $i . '*~', $output);