This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
let Service, Characteristic | |
module.exports = (homebridge) => { | |
/* this is the starting point for the plugin where we register the accessory */ | |
Service = homebridge.hap.Service | |
Characteristic = homebridge.hap.Characteristic | |
homebridge.registerAccessory('homebridge-switch-example', 'SwitchExample', SwitchAccessory) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var template = "{?condition}Condition exists! {condition}{/condition}\n\n" + | |
"{^whereami}I am not here!{/whereami}\n\n" + | |
"{#list}{name} is {age} years old! {?old}They are *old*!{/old}{!old}They are not old!{/old}\n{/list}"; | |
console.log(stache(template, { | |
condition: "Hello world!", | |
list: [ | |
{name: "Charles", age: "25"}, | |
{name: "Bob", age: "42", old: true}, | |
{name: "Samantha", age: "32"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* Copyright(c) 2013 Robert Maupin. Released under the ZLIB License. */ | |
if(count($_FILES) > 0) { | |
extract($_FILES['file']); | |
list($w,$h,$type)=getimagesize($tmp_name); | |
/*see exif-imagetype() documentation :) */ | |
if(!$type||$type>3||filesize($tmp_name)>1024*200) | |
exit(); | |
$ext=image_type_to_extension($type,false); | |
$md5=md5_file($tmp_name); | |
move_uploaded_file($tmp_name,$n="img/$md5.$ext"); |