This file contains hidden or 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 namespace App\Http\Controllers; | |
use App\Http\Controllers\Controller; | |
use Input; | |
use Auth; | |
use View; | |
use Session; | |
use Validator; | |
use Redirect; |
This file contains hidden or 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 hidden or 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
// validate that mobile number starts with '07' | |
$rules = [ | |
'mobile' => 'required|numeric|startswith:07', | |
]; | |
// custom validator called startswith | |
Validator::extend('startswith', function( $attribute, $value, $parameters ) { | |
return substr( $value, 0, strlen( $parameters[0] ) ) == $parameters[0]; | |
}); |
This file contains hidden or 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
// Remember to include the required classes, e.g. Hash, Validator, Redirect, User model | |
// define validation rules, 'password' will be our custom rule | |
$rules = [ | |
'current_password' => 'required|password', | |
'password' => 'required|confirmed|min:6', | |
]; | |
// custom rule for 'password' | |
Validator::extend('password', function( $attribute, $value, $parameters ) { |
This file contains hidden or 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
# Start MongoDB Shell | |
mongo | |
# Get MongoDB version | |
mongo --version | |
# Show Mongo Databases (from MongoDB Shell) | |
show dbs | |
# Create DB `parse` and Insert Data to `users` collection |
This file contains hidden or 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
# Import the Public Key for Official MongoDB Repo | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
# Update apt-get to get latest MongoDB packages | |
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list | |
# Update apt-get package list with new repo details | |
sudo apt-get update | |
# Install the latest version of MongoDB |
This file contains hidden or 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
# Install NodeJS 4.x | |
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
# Install NodeJS 5.x | |
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
# Optional - Needed to compile and install native add-ons | |
sudo apt-get install -y build-essential |
This file contains hidden or 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
# Save data using Parse API | |
curl -X POST \ | |
-H "X-Parse-Application-Id: YOUR_APP_ID" \ | |
-H "Content-Type: application/json" \ | |
-d '{"name":"Niraj Shah","score":"1337"}' \ | |
http://localhost:1337/parse/classes/GameScore | |
# Retrieve all the entries in GameScore | |
curl -X GET \ | |
-H "X-Parse-Application-Id: YOUR_APP_ID" \ |
This file contains hidden or 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
var express = require('express'); | |
var ParseServer = require('parse-server').ParseServer; | |
var app = express(); | |
// Specify the connection string for your mongodb database | |
// and the location to your Parse cloud code | |
var api = new ParseServer({ | |
databaseURI: 'mongodb://localhost:27017/myapp', | |
appId: '{YOUR_APP_ID}', |
This file contains hidden or 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
# Install required nodejs packages | |
npm install parse-server express |