Skip to content

Instantly share code, notes, and snippets.

@allaniftrue
allaniftrue / laravel-query-too-many-placeholder.php
Created March 6, 2023 01:48 — forked from sentiasa/laravel-query-too-many-placeholder.php
Laravel - Query +100k placeholders in Laravel using `whereIn()`
<?php
$transactionIds = Transaction::pluck('id'); // +100k transaction ids
$maxAtOneTime = 5000;
$total = count($transactionIds);
$pages = ceil($total / $maxAtOneTime);
$transactions = collect();
@allaniftrue
allaniftrue / s3_set_object_public.sh
Last active February 16, 2023 01:24 — forked from alexclifford/s3_set_object_public.sh
Make S3 object public and private via s3cmd command line
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
@allaniftrue
allaniftrue / formatBytes.js
Created March 23, 2021 02:28 — forked from zentala/formatBytes.js
Convert size in bytes to human readable format (JavaScript)
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:
@allaniftrue
allaniftrue / phpci.yml
Created September 9, 2016 09:54 — forked from skecskes/phpci.yml
phpci.yml Laravel 5 config
build_settings:
verbose: false
prefer_symlink: false
setup:
composer:
action: "install"
prefer_dist: false
test:
@allaniftrue
allaniftrue / countdown.js
Last active August 29, 2015 14:05 — forked from dleatherman/countdown.js
Deprecation updates for moment.js v2.8.1
$(document).ready(function(){
countdown();
setInterval(countdown, 1000);
function countdown () {
var now = moment(), // get the current moment
// May 28, 2013 @ 12:00AM
then = moment([2014, 9, 20]),
// get the difference from now to then in ms
ms = then.diff(now, 'milliseconds', true);
// If you need years, uncomment this line and make sure you add it to the concatonated phrase
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
* Updated for Laravel 4.2.1 (2014-06-01)
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
*/
namespace {