Skip to content

Instantly share code, notes, and snippets.

View shengslogar's full-sized avatar
👨‍💻
coding or whatever

Sheng Slogar shengslogar

👨‍💻
coding or whatever
View GitHub Profile
@shengslogar
shengslogar / snippet.md
Last active August 21, 2022 18:29
Limit VirtualBox Resources with Vagrant

Place the following in your Vagrantfile.

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.provider "virtualbox" do |vb|
      vb.memory = 1024
      vb.cpus = 2
      vb.customize ["modifyvm", :id, "--cpuexecutioncap", "40"]
    end
end
@shengslogar
shengslogar / default-laravel-relations.php
Last active February 26, 2019 03:12
Specify a Default Laravel Relationship
/**
* Get the author of the post.
* @see https://laravel.com/docs/5.7/eloquent-relationships#updating-belongs-to-relationships
*/
public function user()
{
return $this->belongsTo('App\User')->withDefault([
'name' => 'Guest Author',
]);
}

Backup and Restore MySQL RDS JawsDB via CLI

Export

mysqldump -h HOST -u USERNAME -pPASSWORD DATABASE_NAME > dump.sql --column-statistics=0 --set-gtid-purged=OFF

Import

@shengslogar
shengslogar / laravel-helpers.php
Created May 21, 2020 22:30
Running list of global Laravel helpers I autoload into projects
<?php
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;
/**
* Wrapper for Arr::wrap
*
sudo -H -u www-data COMMAND
@shengslogar
shengslogar / images-on-the-web.md
Created August 29, 2020 07:14
Images on the Web

Images on the Web

Browsers

Firefox and Safari both render colors using sRGB. Chrome isn't consistent. This can be forced through chrome://flags/#force-color-profile and selecting sRGB.

Photoshop

When designing images, use View > Proof Setup > Monitor RGB for an accurate rendering, ensure Edit > Color Settings is on "North America General Purpose 2", and export images by ticking "Convert to sRGB" and deselecting "Embed Color Profile" (Chrome does not support image profiles).

Keybase proof

I hereby claim:

  • I am ShengSlogar on github.
  • I am shengslogar (https://keybase.io/shengslogar) on keybase.
  • I have a public key whose fingerprint is 775B 05AE CE86 1F36 A9A4 41A8 C960 6BFB DD2E F9A7

To claim this, I am signing this object:

@shengslogar
shengslogar / copy-mysql-db.md
Created May 22, 2021 05:04
Copy MySQL database while excluding limiting security definers

Upgrade

  brew unlink php@7.1
  valet use php@7.4

Downgrade

valet use php@7.1

Install Imagick on M1/Apple Silicon with Homebrew

If you're getting the following error after running pecl install imagick:

/opt/homebrew/Cellar/php@7.4/7.4.22/include/php/ext/pcre/php_pcre.h:25:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 error generated.
make: *** [imagick.lo] Error 1