Skip to content

Instantly share code, notes, and snippets.

View marks's full-sized avatar

Mark Silverberg marks

View GitHub Profile
answer()
result = ask("What's your destination?", [
choices: "http://gist.github.com/raw/559213/c83cf025a22acab46ec9e5691c69deff76ce3b7b/grammar.grxml"])
say("You chose $result.value")
answer()
say("<?xml version="1.0" encoding="UTF-8"?><speak>One potato, two potato, three potato, four.<prosody rate="-10%">One potato, two potato, three potato, four.</prosody><prosody rate="-30%">One potato, two potato, three potato, four.</prosody><prosody rate="-50%">One potato, two potato, three potato, four.</prosody></speak>")
puts 'What is your name?'
name = gets.chomp
puts 'What is your age?'
age = gets.chomp
puts "Well, #{name}, next year you will be #{age.to_i+1}"
#!/usr/bin/env python
# A github post-receive hook handler, runs some shell command on each HTTP POST to PORT.
# github-listener.py PORT 'SOME SHELL COMMAND'
import sys
from subprocess import *
from flask import Flask
def system(cmd):
print ''.join(Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, close_fds=True).communicate())
<?php
require_once 'lib/limonade.php';
function configure()
{
option('session', 'my_session_name'); // enable with a specific session name
}
dispatch('/', 'example_index');
function example_index()
@marks
marks / personal_ivr.js
Created March 22, 2012 22:19 — forked from anonymous/inbound code tropo
Tropo code for "hareem" on IRC
answer();
// if its me, ask me for a number to call
if(currentCall.callerID == "_your_phone_number_" || currentCall.callerID == "your_sip_url_"){
var result = ask("Enter the 10 digit phone number now.", {
  choices: "[10 DIGITS]",
  attempts: 3
});
transfer("tel:+1"+result.value,{
callerID : "111",
@marks
marks / get_tweets.rb
Created March 26, 2012 16:22 — forked from eric-wood/get_tweets.rb
Load real-time tweets into ActiveRecord (strips out location data)
#!/usr/bin/env ruby
require 'tweetstream'
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require APP_PATH
Rails.application.require_environment!
TweetStream.configure do |config|
config.consumer_key = 'redacted'
@marks
marks / glass.html
Created March 30, 2014 02:02 — forked from bwhite/glass.html
[wearscript] Scan a QR code with Glass and have links open in tabs on your phone/laptop
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function qr(data, format) {
WS.publish('urlopen', atob(data));
}
function server() {
WS.say('Scan a QR Code');
WS.qr('qr');
}
@marks
marks / glass.html
Created March 30, 2014 02:06 — forked from drGrove/glass.html
[wearscript] Wearscript is Awesome!
<html style="width:100%; height:100%; overflow:hidden" data-test>
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
WS.log('Welcome to WearScript');
WS.say('Wearscript is awesome');
@marks
marks / test.rb
Created July 10, 2014 00:45 — forked from frank-lsf/test.rb
# In the following code, the two gsub's have different outcomes.
ver = 9999
str = "\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleVersion</key>\n\t<string>0.1.190</string>\n\t<key>AppID</key>\n\t<string>000000000000000</string>"
puts str.gsub /(CFBundleVersion<\/key>\n\t.*\.).*(<\/string>)/, "#{$1}#{ver}#{$2}"
puts '--------'
puts str.gsub /(CFBundleVersion<\/key>\n\t.*\.).*(<\/string>)/, "#{$1}#{ver}#{$2}"