This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "hello world" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in your view (HAML + simple_form, simplified for easier reading) | |
= simple_form_for @bp_reading do |f| | |
= f.input :recorded_at, :as => :string, :input_html => { :class => 'jquery-ui-date'} | |
= f.input :recorded_at, :as => :hidden, :input_html => { :id => 'recorded-at-alt'} | |
= f.button :submit, :disable_with => "Saving...", :value => "Save" | |
# in your javascript (coffeescript) | |
$ -> | |
$(".jquery-ui-date").datepicker( | |
altField: "#recorded-at-alt", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Responsive Design | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height:100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%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" => ""} |
OlderNewer