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 / parse-datatypes.js
Last active August 29, 2015 14:03
Parse.com JavaScript SDK - DataType Examples
// string dataType
profile.set( 'bio', 'I am a PHP developer' );
// number dataType
profile.set( 'age', 29 );
// pointer to User class
profile.set( "userId", { "__type": "Pointer", "className": "_User", "objectId": Parse.User.current().id } );
// pointer to custom class
@niraj-shah
niraj-shah / parse-datatypes.php
Created July 3, 2014 12:52
Parse.com PHP SDK - DataType Examples
<?php
// string dataType
$parse->bio = "I am a PHP developer";
// number dataType
$parse->age = 29;
// pointer to User class
$parse->userId = $parse->dataType( 'pointer', array( '_User', $user_id ) );
@niraj-shah
niraj-shah / parse-pointers.js
Created July 3, 2014 12:39
Parse.com JavaScript SDK - Using Pointers and ACL
// new Profile object
var Profile = Parse.Object.extend("Profile");
var profile = new Profile();
// set DOB as date - needs to be ISO format
var dob = new Date("1985-01-01");
profile.set( 'dob', { "__type": "Date", "iso": dob.toISOString() } );
// bio string data
profile.set( 'bio', 'I am a PHP developer' );
// pointer to User table (parse Classes should have _ prefix.)
@niraj-shah
niraj-shah / parse-pointers.php
Created July 3, 2014 12:22
Parse.com PHP SDK - Using Pointers and ACL
<?php
require_once( 'Parse/parse.php' );
// User ID from User table
$user_id = 'QLaLLqjJWi';
// new Profile object
$parse = new parseObject('Profile');
// set DOB as date - uses strtotime
@niraj-shah
niraj-shah / index.php
Created June 24, 2014 17:41
PHP file to redirect visitors to iOS or Android app files
<?php
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
$iPod = stripos( $_SERVER['HTTP_USER_AGENT'], "iPod" );
$iPhone = stripos( $_SERVER['HTTP_USER_AGENT'], "iPhone" );
$iPad = stripos( $_SERVER['HTTP_USER_AGENT'], "iPad" );
$Android = stripos( $_SERVER['HTTP_USER_AGENT'], "Android" );
$webOS = stripos( $_SERVER['HTTP_USER_AGENT'], "webOS" );
@niraj-shah
niraj-shah / tag_store.php
Created June 12, 2014 19:35
Using a ID from taggable_friends to post Status Update using Graph API 2.0 and Facebook PHP SDK 4.0.x
<?php
// requires Facebook PHP SDK 4.0.x or later
// user must be logged-in prior to API call
// publish story, requires 'places' attribute
// use a page_id with no address to tag hidden location
// $tags is a comma-separated string of IDs
$story = (new FacebookRequest( $session, 'POST', '/me/feed', array(
@niraj-shah
niraj-shah / fb_sdk_4.0.8.php
Last active October 22, 2024 02:31
Facebook PHP SDK v4.0.8 Class Changes
<?php
// Facebook PHP SDK v4.0.8
// path of these files have changes
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/Entities/AccessToken.php' );
@niraj-shah
niraj-shah / fb_tab_app_likegate_4.0.x.php
Last active August 29, 2015 14:02
Creating a Facebook Page Tab App using the Facebook PHP SDK 4.0.x. This is a example how to create a likegate.
<?php
// include lines 1-65 from https://gist.github.com/niraj-shah/fcd17411def017e3aefc here
// see if the viewer has liked the page
if ( $pageHelper->isLiked() ) {
// see if we have a session
if ( isset( $session ) ) {
// show logged-in user id
@niraj-shah
niraj-shah / fb_tab_app_4.0.x.php
Last active January 22, 2024 11:42
Creating a Facebook Page Tab App using the Facebook PHP SDK 4.0.x
<?php
// required Facebook PHP SDK v4.0.9 or later.
// include required files form Facebook SDK
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/Entities/AccessToken.php' );
require_once( 'Facebook/Entities/SignedRequest.php' );
@niraj-shah
niraj-shah / ci_fb_sdk_4.0.txt
Last active August 29, 2015 14:02
Facebook PHP SDK 4.0.x with CodeIgnitor
.
└── /
β”œβ”€β”€ application
β”‚ β”œβ”€β”€ cache
β”‚ β”œβ”€β”€ config
β”‚ β”œβ”€β”€ controllers
β”‚ β”œβ”€β”€ core
β”‚ β”œβ”€β”€ errors
β”‚ β”œβ”€β”€ helpers
β”‚ β”œβ”€β”€ hooks