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 | |
// FOR LARAVEL | |
Route::get('route-list', function() { | |
$routeCollection = Route::getRoutes(); | |
echo "<table style='width:100%'>"; | |
echo "<tr>"; | |
echo "<td width='10%'><h4>HTTP Method</h4></td>"; |
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 | |
// ..... | |
$img = Image::make('images/picture.jpg'); | |
$watermark = Image::make('images/watermark.png'); | |
$x = 0; | |
while ($x < $img->width()) { |
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
package main | |
import "fmt" | |
var taste bool | |
func main() { | |
fruit := "banana" | |
count := 10 | |
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 | |
namespace App\Http\Controllers\Auth; | |
use App\Http\Controllers\Controller; | |
use App\Models\User; | |
use Auth; | |
use Illuminate\Http\Request; | |
use Socialite; |
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 | |
.... | |
$products = Product::paginate(); | |
$products->getCollection()->each(function($product) { | |
// insert new data | |
$product->price = 1000; | |
}); |
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
# create encrypted password | |
# sudo sh -c "echo -n 'fpp:' >> /etc/nginx/.htpasswd" | |
# sudo sh -c "openssl passwd bar >> /etc/nginx/.htpasswd" | |
foo:BKlWoa/TUkUgc |
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
<!-- app/Http/Middleware/AdminAuthenticate.php --> | |
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Auth; | |
class AdminAuthenticate |
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 | |
$response = ... | |
$this->app['session.store'] |
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 | |
class UserController extends Controller | |
{ | |
public function index() | |
{ | |
$users = App\Models\Member::paginate(15, ['*'], "page[limit]"); | |
$users->appends(['name' => 'bertho']); |
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
describe 'Race condition POST /api/v1/transaction/electricity', vcr: { cassette_name: 'race_condition_transaction_electricity' } do | |
it { expect(ActiveRecord::Base.connection.pool.size).to eq(5) } | |
context 'send requests simultaneously' do | |
let!(:user) { create(:user, limit_credit: 500_000, balance: 60_000) } | |
it 'should create one transaction' do | |
begin | |
concurrency_level = 4 | |
fail_occurred = false |
OlderNewer