This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// parameters for ajax calls | |
var items = [ | |
{ 'gender': 'male', 'nat': 'US' }, | |
{ 'gender': 'female', 'nat': 'GB' } | |
]; | |
// function to trigger the ajax call | |
var ajax_request = function(item) { | |
var deferred = $.Deferred(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Regex example to validate the format of a Emirates | |
* ID number. Does not validate the checkbit (Luhn Algorithm). | |
* | |
* @author Niraj Shah <niraj@webniraj.com> | |
*/ | |
// regex to validate the format xxx-xxxx-xxxxxxx-x (Emirates ID) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/php | |
<?php | |
// get command line arguments | |
$args = $argv; | |
// AbuseIPDB API Key | |
$api_key = 'xxx'; | |
// your AbuseIPDB User ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ACL to restrict write to user, and public read access | |
var custom_acl = new Parse.ACL(); | |
// give write access to the current user | |
custom_acl.setWriteAccess( Parse.User.current(), true); | |
// give public read access | |
custom_acl.setPublicReadAccess(true); | |
GameObject.setACL(custom_acl); | |
// ACL to restrict write to user, and no public access | |
var custom_acl = new Parse.ACL(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command Line to run from terminal | |
# Logs result to file s3_backup.log | |
# Command will run in the background | |
s3cmd sync -v /path/to/folder/ s3://s3-bucket/folder/ > s3_backup.log 2>&1 & | |
# Crontab command to sync folder to S3 | |
# Command will run 1am every day and logs result to /root/s3_backup.log | |
0 1 * * * /usr/bin/s3cmd sync -rv /path/to/folder/ s3://s3-bucket/folder/ >> /root/s3_backup.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# location of keystore | |
storeFile=/path/to/app.keystore | |
# Key alias | |
keyAlias=alias_name | |
# Store password | |
storePassword=Password1 | |
# Key password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |