Skip to content

Instantly share code, notes, and snippets.

@Dianoga
Dianoga / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../paper-slider/paper-slider.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@Dianoga
Dianoga / hook-concat-templates
Created May 14, 2014 16:11
Codekit hook to concatenate templates into html file
php -r '
$filename = "index2.html";
$file = file_get_contents($filename);
$views = str_replace("</script>", "</script>\n", `cat views/*`);
$find = "/(<!--StartTemplates-->)(.*)(<!--EndTemplates)/s";
$replace = "$1\n{{templates}}\n$3";
$file = preg_replace($find, $replace, $file);
$file = str_replace("{{templates}}", $views, $file);
@Dianoga
Dianoga / nest.devicetype.groovy
Last active September 16, 2018 02:09
Nest Device Type for SmartThings
/**
* Nest Direct
*
* Author: dianoga7@3dgo.net
* Date: 2013-07-18
* Code: https://gist.github.com/Dianoga/6055918
*
* INSTALLATION
* =========================================
* 1) Create a new device type (https://graph.api.smartthings.com/ide/devices)
@Dianoga
Dianoga / hvac-autoonoff.smartapp.groovy
Created July 22, 2013 15:15
A SmartApp to automatically turn off a thermostat when contact sensors open. It will restore thermostat mode when all sensors are closed again
/**
* HVAC Auto Off
*
* Author: dianoga7@3dgo.net
* Date: 2013-07-21
*/
preferences {
section("Control") {
input("thermostat", "capability.thermostat", title: "Thermostat")
}
@Dianoga
Dianoga / sunrise-sunset.groovy
Created July 5, 2013 13:35
Sunrise/Sunset Mode Changer SmartApp
/**
* Sunrise/Sunset
*
* Author: dianoga7@3dgo.net
* Date: 2013-06-26
*/
preferences {
section("Sunrise") {
input ('sunrise_mode', 'mode', title: 'Change to mode: ')
}
@Dianoga
Dianoga / nightlight.groovy
Last active December 19, 2015 09:39
Security/Night Light SmartApp
/**
* Clever Night Light
*
* Author: Brian Steere
*/
preferences {
section("Turn on which things") {
input "switches", "capability.switch", title: "Things", multiple: true
@Dianoga
Dianoga / nest.device-type.groovy
Created July 1, 2013 19:06
Nest Device Type for SmartThings
/**
* Nest
*
* Author: dianoga7@3dgo.net
* Date: 2013-06-24
*/
// for the UI
metadata {
simulator {
}
@Dianoga
Dianoga / node.service
Created December 13, 2012 15:51
systemd .service file for node.js app. Requires forever.
[Unit]
Description=Start Herir Node.js Service
Requires=network.target
After=network.target
[Service]
Type=forking
WorkingDirectory=/srv/hereir/node
ExecStart=/usr/bin/forever start --pidFile /var/run/hereir.pid HereIR.js
ExecStop=/usr/bin/forever stop HereIR.js