Skip to content

Instantly share code, notes, and snippets.

@shortjared
shortjared / RecipeApi.php
Last active December 30, 2015 20:39
API for Recipe Website, user validation.
<?php
class RecipeApi extends \Restful {
// /**
// * Don't wrap output in `{"success":bool,"data":"..."}`.
// */
var $wrap = false;
// /**
// * Create a new recipe or ingredient.
@shortjared
shortjared / server.rb
Last active December 21, 2015 23:58
A simple example of continuously reading from a serial based device and using websockets to send data to all registered clients on the server.
# coding: utf-8
require 'sinatra'
require 'sinatra-websocket'
require 'serialport'
set :server, 'thin'
set :sockets, []
## Setup to read from your device via serial port
ser = SerialPort.new("/dev/your_device", 9600, 8, 1, SerialPort::NONE)