Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Jacobs capndesign

View GitHub Profile
@capndesign
capndesign / README.md
Last active Apr 7, 2017
Connecting a Dash Button to IFTTT
View README.md

Earlier in the week, I saw a Medium piece about using Dash buttons as a cheap connected device, and decided to play with it. I decided the most flexible solution was to wire it to IFTTT, so I did that.

He has instructions, but here’s what I did.

  1. Create a virtualenv and install Scapy.
  2. Then install Requests.
  3. Follow the instructions on Medium to get the MAC address of your device.
  4. Learn how to use the Maker channel and create a URL for this trigger.
  5. Modify your dash-button.py file to match the one below and fill in the right information.
  6. Create an IFTTT recipe and go to town.
View index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesh.css"/>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="script1.js"></script>
</head>
<body>
<div id="box">
View gist:8964004
### Keybase proof
I hereby claim:
* I am capndesign on github.
* I am capndesign (https://keybase.io/capndesign) on keybase.
* I have the public key with fingerprint E060&nbsp;0318&nbsp;C622&nbsp;F735&nbsp;D82E&nbsp;&nbsp;DF3D&nbsp;5B09&nbsp;4948&nbsp;B111&nbsp;51F2
To claim this, I am signing the following object:
View footnotes.html
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
</head>
<body>
<p>I am a sentence that needs some additional information<sup><a href="#footnote-1-text" rel="footnote" id="footnote-1-link">1</a></sup></p>
<h4>Footnotes</h4>
@capndesign
capndesign / bookmarklet.js
Created Nov 16, 2010
My staging version of the Typekit Colophon bookmarklet
View bookmarklet.js
javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='https://gist.github.com/raw/702689/typekit-colophon.js';document.getElementsByTagName('head').item(0).appendChild(s);void('')})();
@capndesign
capndesign / bookmarklet.js
Created Nov 16, 2010 — forked from markpasc/bookmarklet.js
Install this as a bookmarklet and it will show the site's colophon if it uses TypeKit.
View bookmarklet.js
javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='https://gist.github.com/raw/701397/typekit-colophon.js';document.getElementsByTagName('head').item(0).appendChild(s);void('')})();
@capndesign
capndesign / typekit-colophon.js
Created Nov 12, 2010
(Old Version) Install this as a bookmarklet and it will show the site's colophon if it uses TypeKit.
View typekit-colophon.js
javascript:a=document.getElementsByTagName('script');y=''; for (i=0;i < (a.length - 1);i++) { x=a[i].getAttribute('src'); if(x) { if (x.search('typekit') >= 1) { var y='http://typekit.com/colophons/' + x.substring(23,30); } } } if (y != '') { window.location.assign(y); } else { void(y); alert('This site doesn\'t use Typekit!'); }
@capndesign
capndesign / pagination.js
Created Apr 13, 2010
A method for adding new entries to the bottom of an index with AJAX in Movable Type. It requires jQuery.
View pagination.js
$(document).ready(function() {
var page = 1;
$('.load-posts').click(function() {
$('.article:last').after('<div id="ajax-loader">Loading Data</div>');
page++;
var contentUrl = '/cgi-bin/mt/mt-search.cgi?page=' + page;
if ($(this).attr('id') == 'category-posts') { contentUrl += '&IncludeBlogs=1&limit=20&category=' + catId + '&archive_type=Category'; }
if ($(this).attr('id') == 'index-posts') { contentUrl += '&IncludeBlogs=1,4&limit=20&archive_type=Index'; }
$.get(contentUrl, function(data) {
if (data != '') {
@capndesign
capndesign / multipage-articles.html
Created Jan 4, 2010
Multi-page Articles with JQuery
View multipage-articles.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="">
<head>
<title>Multipage Article</title>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.query-2.1.7.js"></script>
<script type="text/javascript">
$('.entry-permalink .entry-body').ready(function() {
var text = $('.entry-permalink .entry-body').html();