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.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-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-acl.php
Last active August 29, 2015 14:03
Parse.com PHP SDK - ACL Examples
<?php
// true = access allowed, false = not allowed
// create ACL
$acl = new parseACL();
// public can read
$acl->setPublicReadAccess( true );
// public cannot write
@niraj-shah
niraj-shah / parse-acl.js
Created July 3, 2014 13:13
Parse.com JavaScript SDK - ACL Examples
// true = access allowed, false = not allowed
// create ACL
var acl = new Parse.ACL();
// public can read
acl.setPublicReadAccess( true );
// public cannot write
acl.setPublicWriteAccess( false );
// user can read data
@niraj-shah
niraj-shah / autoload.php
Last active August 29, 2015 14:04
Autoloader for Official Parse PHP SDK
<?php
/**
* You only need this file if you are not using composer.
* Adapted from the Facebook PHP SDK 4.0.x autoloader
*/
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
throw new Exception('The Parse SDK requires PHP version 5.4 or higher.');
}
@niraj-shah
niraj-shah / parse.php
Last active August 29, 2015 14:04
Using the official Parse PHP SDK v1.0
<?php
// define location of Parse PHP SDK, e.g. location in "Parse" folder
// Defaults to ./Parse/ folder. Add trailing slash
define( 'PARSE_SDK_DIR', './Parse/' );
// include Parse SDK autoloader
require_once( 'autoload.php' );
// Add the "use" declarations where you'll be using the classes
@niraj-shah
niraj-shah / find_and_delete.sh
Last active August 29, 2015 14:05
Find and delete .svn / .git subdirectories in a given folder
# === SVN === #
# find .svn folders in current directory
find . -name .svn -exec echo {} \;
# delete .svn folders in current directory
find . -name .svn -exec rm -rfv {} \;
# === GIT === #
@niraj-shah
niraj-shah / find_php.sh
Created August 7, 2014 12:45
Find PHP and .DS_Store files in current directory
# Find PHP files in current directory
find . -name *.php -exec echo {} \;
# Find annoying .DS_Store files in current directory (Mac issue)
find . -name .DS_Store -exec echo {} \;
# Find log files in current directory (ending in.log)
find . -name *.log -exec echo {} \;
@niraj-shah
niraj-shah / map.html
Last active August 29, 2015 14:05
Cage Cricket "Where to Play" Map Embed Code
<div id="cc-map"></div>
<!-- uses latest version of jQuery (v2.1.1) -->
<script src="http://www.cagecricket.com/wp-content/plugins/cage-cricket/map-embed.php"></script>
<!-- jQuery-less version -->
<script src="http://www.cagecricket.com/wp-content/plugins/cage-cricket/map-embed.php?jquery=false"></script>
@niraj-shah
niraj-shah / pagination.php
Created August 12, 2014 12:00
Parse Pagination Using Unofficial PHP Parse SDK from: https://github.com/apotropaic/parse.com-php-library
<?php
// using https://github.com/apotropaic/parse.com-php-library PHP Parse Library
require_once( 'Parse/parse.php' );
$query = new parseQuery('TestClass');
// hack to get all results
$query->whereNotEqualTo( 'name', 'foo' );