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
// convert string to proper case | |
String.prototype.toProperCase = function () { | |
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); | |
}; | |
// convert string to snake case | |
String.prototype.toSnakeCase = function () { | |
return this.replace(/(.)([A-Z])/g, "$1_$2").toLowerCase(); | |
}; |
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
To manually dump the database you can run the following one-liner code | |
mysqldump -u[user] -p[pass] [db] > [file_path] | |
But what if you want to automate the process, here are the steps: | |
1. Setup cron entry to your server | |
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1 | |
2. Create a command BackupDatabase by running the following code: |
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
Use the following parameters in .env file: | |
HTTPS_PROXY={http/https://}PROXY_USER:PROXY_PWD@PROXY:PROXY_PORT | |
(Combination of Proxy Address:Proxy Password@Proxy Address with port, don’t include http/https) | |
PROXY=xxxxxx (Proxy Name) | |
PROXY_PORT=xxxx (Proxy Port) | |
PROXY_USER=xxxxxxxxx (Proxy User Name) | |
PROXY_PWD=xxxxxxxxx (Proxy User Password) | |
PROXY_TYPE=CURLPROXY_HTTP |
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
1. Cut all the files and folders in public directory and paste it to root folder | |
2. Update the index.php as below: | |
<?php | |
/** | |
* Laravel - A PHP Framework For Web Artisans | |
* | |
* @package Laravel |
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
// GET request | |
$request = Request::create(config('app.url') . '/your-url-here', 'GET'); | |
$response = Route::dispatch($request); | |
return $response; | |
// POST request | |
$params = array( | |
'product_code' => 'GYU16R', | |
'qty' => '1', | |
'price' => 660, |
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
mysql -u {user_name} -p -h {IP} -D {database_name} | |
Parameters: | |
user_name: MySQL user name on remote server | |
IP: IP Address of remote server | |
database_name: Name of the database on remote server |
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
The output of Google News RSS is in XML format. Here is a sample Google News RSS XML output: | |
<rss xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> | |
<channel> | |
<generator>NFE/5.0</generator> | |
<title>"Apple" - Google News</title> | |
<link> | |
https://news.google.com/search?q=apple | |
</link> | |
<language>en-IN</language> |
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
$("body").tooltip({ | |
selector: '[data-toggle="tooltip"]', | |
trigger : 'hover' | |
}); | |
// selector: This method helps to initialise tooltips and works even if tooltip is generated dynamically | |
// trigger: This will show tooltip only when the cursor is placed on the element. | |
// When clicked on any element or button, the tooltip stays intact even if the cursor if not placed on it. | |
// The 'trigger' method helps to solves this issue and show only when cursor is placed on the element |
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
$('body').find('.draggable').draggable({ | |
stack: ".draggable", | |
helper: 'clone', | |
start: function(event, ui) { | |
$(this).draggable('instance').offset.click = { | |
left: Math.floor(ui.helper.width() / 2), | |
top: Math.floor(ui.helper.height() / 2) | |
}; | |
ui.helper.css('cursor', 'move'); |
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
$token = app('auth.password.broker')->createToken(auth()->user()); | |
OR | |
$token = app('auth.password.broker')->createToken($user); | |
$user must implement App\User |