Skip to content

Instantly share code, notes, and snippets.

View mvilrokx's full-sized avatar

Mark Vilrokx mvilrokx

View GitHub Profile
if ($("#call").is(':checked')) {
$.ajax({
type: "POST",
username: twilio.username,
password: twilio.pwd,
url: twilio.server_url + twilio.username + '/Calls.json',
data: { Url: <xml-containing-twilio-message>, From: twilio.phone, To: user.phone }
})
.done(function( msg ) {
console.log("Phone call made.");
@mvilrokx
mvilrokx / twillioSMS.js
Created January 21, 2015 22:07
Calling the Twilio SMS API
var twilio = {
username: <your-twilio-username>,
pwd: <your-twilio-pwd>,
phone: <your-twilio-phone-number>,
server_url: 'https://api.twilio.com/2010-04-01/Accounts/'
};
var user = {
phone: <user-phone-number>
};
@mvilrokx
mvilrokx / speechSynthesis.js
Created January 21, 2015 21:58
Calling the HTML5 Speech Synthesis API
if ($("#speech").is(':checked')) {
window.speechSynthesis.cancel(); // Cancel if already talking
var msg = new SpeechSynthesisUtterance(event.target.innerText); // Grab the text from the element that was clicked ...
window.speechSynthesis.speak(msg); // ... and speak it.
}
@mvilrokx
mvilrokx / opendyslexic.css
Created January 15, 2013 06:09
OpenDyslexic CSS
@font-face {
font-family: 'opendyslexic';
src: url('http://dyslexicfonts.com/fonts/OpenDyslexic-Regular.otf');
font-style: normal;
font-weight: normal;
}
@font-face {
font-family: 'opendyslexic';
src: url('http://dyslexicfonts.com/fonts/OpenDyslexic-Italic.ttf');
@mvilrokx
mvilrokx / speechChange.js.coffee
Created December 9, 2012 15:53
Iris: Function called when a speech recognition result is received.
# Function called when a speech recognition result is received.
speechChange = (e) ->
# Flow
# 1. pass received text to service that can interpret the text (using WolframAlpha right now)
# 2. when this service returns, show results of this service in the stream
e.preventDefault()
if e.type == 'webkitspeechchange' && e.originalEvent.results
topResult = e.originalEvent.results[0]
adjustStream(topResult.utterance)
# submit the form to the proxy service
@mvilrokx
mvilrokx / iris-home-view.html.haml
Created December 9, 2012 15:39
Iris Home view
%ol#stream
%li.stream-item
What can I help you with?
#speech-form
=form_tag("/home/process_speech", :method => :get, :id=>"process_speech") do
%input#speech-button{:name => "utterance", :type => "text", "x-webkit-speech" => ""}
@mvilrokx
mvilrokx / iris-speech-button.css
Created December 9, 2012 15:33
Style an input field for Voice Input only
#speech-button{
font-size: 250%;
border: none;
outline: none;
width: 42px;
cursor: pointer;
@include border-radius(10px);
text-indent: -9999px;
color: #fff;
}
@mvilrokx
mvilrokx / siriproxy-squeezebox.rb
Created December 9, 2012 13:54
Siriproxy Squeezebox plugin
class SiriProxy::Plugin::Squeezebox < SiriProxy::Plugin
def initialize(config)
@s = Squeezeboxer.new(config)
end
listen_for /radio on/i do
@s.power('1')
say "Radio is now turned on!"
request_completed
end
@mvilrokx
mvilrokx / squeezebox.rb
Created December 9, 2012 13:36
Siri Proxy Squeezebox plugin: the squeezebox class
class Squeezebox
def initialize(config = {})
puts 'enter initialize in Squeezebox'
@t = Net::Telnet::new(
'Host' => config['host']||'localhost',
'Port' => config['port']||9090,
'Prompt' => /./ # needed to work
)
@id_set = false
@mvilrokx
mvilrokx / dabblet.css
Created March 13, 2012 21:45
Responsive Design
/**
* Responsive Design
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;