Skip to content

Instantly share code, notes, and snippets.

View webmasterkai's full-sized avatar
🎯
Focusing

Kai Curry webmasterkai

🎯
Focusing
View GitHub Profile
@webmasterkai
webmasterkai / save-camera-snapshot-notification-on-motion.yaml
Last active March 4, 2024 18:05 — forked from niemyjski/save-camera-snapshot-notification-on-motion.yaml
Home Assistant Blueprint - Save a camera snapshot with archive when motion is detected
blueprint:
name: Save a camera snapshot when motion is detected
description: Save a camera snapshot with archive when motion is detected
domain: automation
source_url: https://gist.github.com/webmasterkai/6011ff64fc1a236b8025181a535dbf87
input:
motion_sensor:
name: Motion sensor
description: The sensor wich triggers the snapshot creation
selector:
{
"data": {
"organization": [
{
"name": "303"
},
{
"name": "Abu Garcia"
},
{
diff --git a/twitter_pull.class.inc b/twitter_pull.class.inc
index 623fdc3..670c2d1 100644
--- a/twitter_pull.class.inc
+++ b/twitter_pull.class.inc
@@ -54,7 +54,7 @@ class twitter_puller {
// if the first character is @, then consider the key a username
elseif ($prefix == "@") {
$key = drupal_substr($this->twitkey, 1);
- $url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name='. urlencode($key) .'&include_rts=true&count='. $num;
+ $url = 'http://dong.cape.io/api/twitter/innovadotmu?tweets=3' . urlencode($key) . '?tweets=' . $num;
@webmasterkai
webmasterkai / _cape.yaml
Created March 22, 2015 20:55
cape config files
---
version: 4.1.0
id: owl
cname: owl.kaicurry.com
api:
db: http://owl.verysimple.co/_api?render=ezle&merge-content=1&merge-data=1&pick=filename
title: S/V OWL - Bayfield, WI
key="" #your maildrill API key
from_email="" #who is sending the email
reply_to="$from_email" #reply email address
from_name="curl sender" #from name
if [ $# -eq 3 ]; then
msg='{ "async": false, "key": "'$key'", "message": { "from_email": "'$from_email'", "from_name": "'$from_name'", "headers": { "Reply-To": "'$reply_to'" }, "return_path_domain": null, "subject": "'$2'", "text": "'$3'", "to": [ { "email": "'$1'", "type": "to" } ] } }'
results=$(curl -A 'Mandrill-Curl/1.0' -d "$msg" 'https://mandrillapp.com/api/1.0/messages/send.json' -s 2>&1);
echo "$results" | grep "sent" -q;
@webmasterkai
webmasterkai / mobile-menu.md
Last active August 29, 2015 14:15
Tech spec for mobile menu
  • When the menu is hidden we say that the menu has the state is closed. {menuOpen: false}
  • When the menu is visible we say that the menu has the state open. {menuOpen: true}
  • The default state of the menu is closed {menuOpen: false} when window width is less than 767px.
  • When the screen shrinks we hide the menu after it crosses the boundry.

Open/Close Toggle

  • The toggle element is added to the DOM when the inner width of the window is less than 767px.
  • Clicking the toggle element changes the boolean state of the menu this.setState({menuOpen: !this.state.menuOpen}).
  • Increasing window width beyond 766 will trigger menu open {menuOpen: true}.
@webmasterkai
webmasterkai / cape_add_remove.json
Last active December 16, 2015 15:19
clicking the "add" or "remove" button to a cape item
{"add": {
"script": "\tif(ctx._source.containsKey('cape_io')) {\n\t\tctx._source.cape_io.added += add;\n\t}\n\telse {\n\t\tctx._source.cape_io = upsert;\n\t\tctx._source.cape_io.added += add;\n\t}\n\t",
"params": {
"add": {
"query": "jobs_northmpls",
"removed": 1366835680,
"user": "northmpls.org"
},
"upsert": {
"removed": [],
@webmasterkai
webmasterkai / img.l
Last active November 3, 2018 08:49 — forked from phpdude/nginx.conf
Mirror remote image files, supports dynamic resizing of images. nginx image_filter remote fetching with a local mirror of original and resized image. Using try_files instead of if statements and proxy_pass with proxy_store for permanent local storage. No cache expiration, that will need to be handled outside of this.
server {
server_name img.l;
root /var/www/cache/store/ns365;
index index.html;
# This requests the original file from itself and then resizes the image.
location ~ /resize/(\d+)x(\d+)/(.*) {
proxy_pass http://img.l/$3;
image_filter resize $1 $2;
image_filter_jpeg_quality 90;
@webmasterkai
webmasterkai / schools.csv-json.php
Last active December 10, 2015 07:38
convert schools csv to individual json files
<?php
/**
* Place this file in the same directory as the csv. PHP must be available to the local machine cli.
* $ php schools.csv-json.php
*/
// Assumes csv file is in the same directory.
define("FILENAME", "schools.csv");
$handle = fopen(FILENAME, 'r');
@webmasterkai
webmasterkai / uc_webform.module
Created November 15, 2012 16:41
adding order props to webform submission
diff --git a/uc_webform.module b/uc_webform.module
index 4c45523436add444bfa921038aec5458070708de..77317ad9d47a22cdc808eead0874fa468ff12377 100644
--- a/uc_webform.module
+++ b/uc_webform.module
@@ -606,7 +606,23 @@ function uc_webform_order($op, &$arg1, $arg2) {
$webform_node = node_load($product->data['webform_nid']);
$webform_submission = webform_menu_submission_load($product->data['webform_sid'], $product->data['webform_nid']);
if (count($webform_node->webform['components'])) {
+ $order_properties = array(
+ 'billing_first_name',