Skip to content

Instantly share code, notes, and snippets.

View robertcedwards's full-sized avatar
🖼️
Framing

Robert C Edwards robertcedwards

🖼️
Framing
View GitHub Profile
@hardillb
hardillb / wemo-control.js
Last active December 13, 2020 15:34
Wemo lights example - "npm install wemo-js xml2js" then "node wemo-contol.js" for instructions
var wemo = require('wemo-js');
var http = require('http');
var util = require('util');
var xml2js = require('xml2js');
var postbodyheader = [
'<?xml version="1.0" encoding="utf-8"?>',
'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">',
'<s:Body>'].join('\n');
@sidwarkd
sidwarkd / config.json.sample
Created April 1, 2015 13:17
Competitor to the Amazon Dash
{
"sparkAccessToken": "",
"sparkDeviceID": "",
"twilioAccountSID": "",
"twilioAuthToken": "",
"toPhoneNumber": "[NUMBER TO CALL]",
"fromPhoneNumber": "[YOUR TWILIO NUMBER]",
"paperTowelTwiml": "[URL TO TWIML FILE. DROPBOX WORKS GREAT]"
}
@erikhazzard
erikhazzard / gist:af39b59b2e6b8255bde2
Last active December 16, 2015 20:12
Mixpanel set avatar image URL
$('#userlist_wrapper .grid_row').each(function(i, el){
var el = $(el);
var id = el.attr('data-distinct_id');
$('.avatar_cell img', el).attr(
'src',
'YOUR_URL_FOR_IMAGE/' + id + '.gif'
);
})
@hardillb
hardillb / wemo-light.js
Last active November 3, 2016 08:08
Wemo lights example - "npm install wemo-js xml2js" then "node wemo-light.js" for instructions
var wemo = require('wemo-js');
var http = require('http');
var util = require('util');
var xml2js = require('xml2js');
var postbodyheader = [
'<?xml version="1.0" encoding="utf-8"?>',
'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">',
'<s:Body>'].join('\n');
@adamculpepper
adamculpepper / ajax-form-submit.js
Last active August 29, 2015 14:08
AJAX form submission (using FormKeep & requires jQuery)
//Simple form
$("form").submit(function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: 'https://formkeep.com/f/7212a0cb4563',
data: $(this).serialize(),
success: function() {
//window.location = "http://google.com";
@dyadica
dyadica / PlayerController.cs
Created October 20, 2014 18:27
A Unity MonoBehaviour that can be applied to a GameObject to provide simple turn on the spot joystick style player movement.
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(CharacterController))]
public class PlayerController : MonoBehaviour
{
/// <summary>
/// The players character controller
/// </summary>
private CharacterController controller;
@robertcedwards
robertcedwards / gist:1cd991a8a1b056e3600c
Created May 7, 2014 04:21
archive of consolas on mac
Notes and links of interest from Alexander Zhuravlev
Jan 11, 2012
How to install Consolas font on Mac OS X
@NickDiMucci
NickDiMucci / BasicEntityCollision.cs
Last active May 16, 2021 06:54
Basic collision detection via ray casting in Unity.
public class BasicEntityCollision : IEntityCollision {
private Vector3 size;
private Vector3 center;
// Give a bit of space between the raycast and boxCollider to prevent ray going through collision layer.
private float skin = .005f;
private LayerMask collisionMask;
private LayerMask playerMask;
public bool OnGround { get; set; }
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@southwolf
southwolf / Pebble.ino
Last active January 26, 2020 20:40
Arduino code for Communicate with Pebble
#include <string.h>
#include <ctype.h>
#include <SoftwareSerial.h>
// the Bluetooth Shield connects to Pin D9 & D10
SoftwareSerial bt(9,10);
const uint8_t req[5] = {0x00, 0x01, 0x00, 0x11, 0x00};
const uint8_t cap[17] = {0x00, 0x0d, 0x00, 0x11, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32};
const uint8_t ping[9] = {0x00, 0x05, 0x07, 0xd1, 0x00, 0xde, 0xad, 0xbe, 0xef};