Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
 writing apps i want to use

Junda samwize

💭
 writing apps i want to use
View GitHub Profile
View Contents.json
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "app-icon-58.png",
"scale" : "2x"
},
{
"size" : "40x40",
@samwize
samwize / Device.h
Created October 21, 2012 06:26
Convenient class to handle the new iPhone 5 taller screen
View Device.h
#import <Foundation/Foundation.h>
@interface Device : NSObject
/** Returns true if it is a iPhone/iPod with 4 inch tall screen */
+(BOOL)isScreen4Inch;
@end
@samwize
samwize / 2FA.php
Created October 22, 2012 08:45
Hoiio Example: 2-Factor Authentication using SMS
View 2FA.php
<?php
/* Hoiio developer credentials */
$hoiioAppId = "YOUR_APP_ID_HERE";
$hoiioAccessToken = "YOUR_ACCESS_TOKEN_HERE";
$sendSmsURL = "https://secure.hoiio.com/open/sms/send";
// User information: Query these from the db
$username = "test";
$password = "password";
@samwize
samwize / click2call.php
Created October 22, 2012 08:58
Hoiio Example: Click-to-call
View click2call.php
<?php
/* Hoiio developer credentials */
$hoiioAppId = "YOUR_APP_ID_HERE";
$hoiioAccessToken = "YOUR_ACCESS_TOKEN_HERE";
$voiceCallURL = "https://secure.hoiio.com/open/voice/call";
/* My Number */
$callMyNumber = "+6511111111";
@samwize
samwize / booking_confirmation.php
Created October 22, 2012 09:01
Hoiio Example: booking confirmation using IVR API
View booking_confirmation.php
<?php
/************
Program flow:
1. User enter booking details on web form.
2. Call out to user.
3. Read out booking details.
4. Ask user to confirm or cancel the booking.
5. Read out user's decision and hang up.
************/
@samwize
samwize / conference_outgoing.php
Created October 22, 2012 09:02
Hoiio API Example: Conference Outgoing
View conference_outgoing.php
<html>
<head>
<title>Hoiio Conference API</title>
</head>
<body style="font-family:arial,helvetica,sans-serif;font-size:13px;margin-top:20px;">
<?php
// Developer information: appId, accessToken
$appId = "YOUR_APP_ID_HERE";
$accessToken = "YOUR_ACCESS_TOKEN_HERE";
@samwize
samwize / conference_incoming.php
Created October 22, 2012 09:04
Hoiio API Example: Conference Incoming
View conference_incoming.php
<?php
/* Instructions:
* In Hoiio Developer Portal under Hoiio Number section, configure the Forwarding URL to this script.
*/
/* Hoiio developer credentials */
$appId = "YOUR_APP_ID_HERE";
$accessToken = "YOUR_ACCESS_TOKEN_HERE";
@samwize
samwize / weather-by-phone.php
Created October 22, 2012 09:43
Hoiio Example: Weather by Phone
View weather-by-phone.php
<?php
/*
Check weather by phone
APIs used
- ivr/middle/gather
- ivr/middle/play
API Flow
1. <-- Incoming call to Hoiio number
@samwize
samwize / sms.php
Created October 23, 2012 07:49
Hoiio Example: Send an SMS
View sms.php
<?php
/* Hoiio developer credentials */
$hoiioAppId = "YOUR_APP_ID_HERE";
$hoiioAccessToken = "YOUR_ACCESS_TOKEN_HERE";
$sendSmsURL = "https://secure.hoiio.com/open/sms/send";
/* Recipient of SMS */
$destination = "+6511111111";
$message = "Congrats! You have just sent your first SMS with Hoiio!";
@samwize
samwize / hoiio_signature.py
Created December 14, 2012 08:15
Compute signature of a http from Hoiio. This is used to authenticate the notification from Hoiio. Match this computed signature with the HTTP header "X-Hoiio-Signature".
View hoiio_signature.py
import hmac
import hashlib
def sign(payload, key):
dig = hmac.new(key, msg=payload, digestmod=hashlib.sha256).digest()
return dig.encode('hex')
if __name__ == "__main__":
import sys
if (len(sys.argv) == 3):