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 | |
$transactionIds = Transaction::pluck('id'); // +100k transaction ids | |
$maxAtOneTime = 5000; | |
$total = count($transactionIds); | |
$pages = ceil($total / $maxAtOneTime); | |
$transactions = collect(); |
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
root@sydney:/mnt/vol2# rclone sync spaces-sgp1:mybucket1 /mnt/vol2 --checkers 256 --transfers 256 --progress --fast-list --size-only | |
2023-02-27 07:18:50 ERROR : 52231/: Failed to copy: failed to open source object: NoSuchKey: | |
status code: 404, request id: tx00000000000001d4ec082-0063fc595a-285cf3d6-sgp1b, host id: | |
2023-02-27 07:18:54 ERROR : Local file system at /mnt/vol2: not deleting files as there were IO errors | |
2023-02-27 07:18:54 ERROR : Local file system at /mnt/vol2: not deleting directories as there were IO errors | |
2023-02-27 07:18:54 ERROR : Attempt 1/3 failed with 3 errors and: failed to open source object: NoSuchKey: | |
status code: 404, request id: tx00000000000001d4ec082-0063fc595a-285cf3d6-sgp1b, host id: | |
Transferred: 2.276M / 2.276 MBytes, 100%, 3.198 MBytes/s, ETA 0s | |
2023-02-27 07:20:04 ERROR : 52231/: Failed to copy: failed to open source object: NoSuchKey: | |
status code: 404, request id: tx00000000000001d4e5352-0063fc59a4-28667c7c-sgp1b, host 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
s3cmd setacl s3://bucket/path/to/file --acl-public | |
s3cmd info s3://bucket/path/to/file | |
s3cmd setacl s3://bucket/path/to/file --acl-private | |
# S3CMD SET ALL FILES IN FOLDER TO PRIVATE | |
s3cmd setacl s3://bucket/path/to/file --acl-private --recursive |
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 { useState } from 'react'; | |
const Test = () => { | |
const [tipAmount, setTipAmount] = useState(''); | |
const handleKeypress = (e) => { | |
if(!((e.keyCode > 95 && e.keyCode < 106) | |
|| (e.keyCode > 47 && e.keyCode < 58) | |
|| e.keyCode == 8)) { | |
e.preventDefault(); // Let's stop this event. |
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 | |
use Illuminate\Validation\ValidationException; | |
throw ValidationException::withMessages(['field_name' => 'This value is incorrect']); |
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
[ | |
{ | |
"label": "Afghanistan", | |
"value": "AF" | |
}, | |
{ | |
"label": "Åland Islands", | |
"value": "AX" | |
}, | |
{ |
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 | |
public function pdf($id) | |
{ | |
//... | |
$pdf = PDF::loadView('pdf.payroll'); | |
return response()->json([ | |
'pdf' => base64_encode($pdf->output()) | |
]); |
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
function formatBytes(bytes,decimals) { | |
if(bytes == 0) return '0 Bytes'; | |
var k = 1024, | |
dm = decimals || 2, | |
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
i = Math.floor(Math.log(bytes) / Math.log(k)); | |
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | |
} | |
// Usage: |
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 | |
if (! function_exists('getSql')) { | |
/** | |
* @param $model | |
* @return string | |
*/ | |
function getSql($model): string | |
{ | |
$replace = function ($sql, $bindings) |
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 | |
... | |
$stack = HandlerStack::create(); | |
$logger = new Logger('Logger'); | |
$handler = new RotatingFileHandler(storage_path('logs/guzzle.log'), 5, Logger::DEBUG, true, 0664); | |
// $logger->pushHandler(new StreamHandler(storage_path('logs/guzzle.log')), Logger::DEBUG); | |
$logger->pushHandler($handler); |
NewerOlder