Skip to content

Instantly share code, notes, and snippets.

View niraj-shah's full-sized avatar
🏠
Working from home

Niraj Shah niraj-shah

🏠
Working from home
View GitHub Profile
@niraj-shah
niraj-shah / geolocation_error_complete.js
Last active December 10, 2015 18:30
The error function
function error(msg) {
// select the span with id status
var s = $('#status');
// set the error message
s.html(typeof msg == 'string' ? msg : "failed");
}
// select the span with id status
var s = $('#status');
// set the error message
s.html(typeof msg == 'string' ? msg : "failed");
@niraj-shah
niraj-shah / geolocation_error_2.js
Created January 7, 2013 11:44
Expanded error function
if ( typeof msg == 'string' ) {
s.html(msg);
} else {
s.html("failed");
}
@niraj-shah
niraj-shah / notification.php
Created January 9, 2013 14:49
Facebook API: App Notifications API for Facebook Canvas Apps
$response = $this->facebook->api( '/' . $user_id . '/notifications', 'POST', array(
'template' => 'You have received a new message.',
'href' => 'path/to/message/?id=' . $id,
'access_token' => $app_access_token
) );
@niraj-shah
niraj-shah / twilio.php
Last active December 10, 2015 21:18
Twilio API: Sending a Text Message
<?php
require 'Services/Twilio.php';
$sid = "aaabbbcccdddeeefffggg"; // Your Account SID from www.twilio.com/user/account
$token = "hhhiiijjjkkklllmmmnnnooo"; // Your Auth Token from www.twilio.com/user/account
$client = new Services_Twilio( $sid, $token );
$message = $client->account->sms_messages->create(
'+44xxx', // From a valid Twilio number
POST https://graph.facebook.com/me/feed?message=this+is+a+test+message&amp;access_token=...
{
"id": "00000000_111111111111"
}
name=Facebook API: Posting a Status Update
&link=https://www.webniraj.com/2012/11/22/facebook-api-posting-a-status-update/
&caption=The Facebook API lets you post status updates in the background.
&message=Check out my new blog post!
https://www.facebook.com/[user_id]/posts/[post_id]
@niraj-shah
niraj-shah / facebook_social_video.php
Created February 7, 2013 10:06
YouTube and Facebook (Social Video) Example
<!DOCTYPE html>
<html>
<!--
Created using jsbin.com
Source can be edited via http://jsbin.com/elafon/1/edit
-->
<head>
<title>YouTube - Like Button - Comments</title>
<link href="socialYoutube.css" rel="stylesheet">