Skip to content

Instantly share code, notes, and snippets.

View lnfel's full-sized avatar
🏠
Working from home

Dale Ryan lnfel

🏠
Working from home
View GitHub Profile
@lnfel
lnfel / .htaccess
Created October 15, 2021 02:25
Enable Gzip compression in Laravel assets #laravel #php
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
@lnfel
lnfel / memory_usage.php
Created October 14, 2021 05:27 — forked from mehdichaouch/memory_usage.php
PHP Snippet to get human readable memory usage
<?php
function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
convert(memory_get_usage());
@lnfel
lnfel / REST API.md
Created September 17, 2021 06:56 — forked from fomvasss/REST API.md
Best practices Laravel Rest API

Best practices написание REST-API

  • Имена полей в ответе задавать в snake_case (prr_page, created_at, system_name,...)
  • Для времени использовать ISO 8601 (формат: YYYY-MM-DDTHH:MM:SSZ)
  • Отдавать данные (сам контент, поля сущностей, массивы сущностей), помещая их в data

Использование REST методов и примеры url'ов

  • GET: /api/users — получить список пользователей;
  • GET: /api/users/123 — получить указанного пользователя;
  • POST: /api/users — создать нового пользователя;
@lnfel
lnfel / .htaccess
Created September 7, 2021 04:46 — forked from morcegon/.htaccess
.htaccess optimized for laravel
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@lnfel
lnfel / heroku_pg:push_workaround.md
Created August 2, 2021 06:04 — forked from michaeltreat/heroku_pg:push_workaround.md
Quick workaround for pushing your local database to heroku for windows machines.

Workaround for pushing to heroku database on windows machince.

Context:

The command heroku pg:push essentially executes two commands under the hood. First, it executes pg_dump, which makes a backup file of a specific database. Then, it pipes that file into pg_restore, where it takes that dump file and uses it to restore another database. The way we usually use it is to push a local database to a deployed heroku database.

The problem is that on windows, the command breaks while trying to pipe in the backup file from pg_dump to pg_restore, so we need to do these two commands manually.

Solution:

@lnfel
lnfel / Install.md
Created July 29, 2021 09:11 — forked from tojibon/Install.md
Installing and Configuring ImageMagick on Xampp

#Steps to Install

  1. Download and Install ImageMagick http://imagemagick.org/script/binary-releases.php#windows
  2. Visit ImageMagic installation directory and module/coders copy all files and past on D:\xampp\apache\bin
  3. Download Binary https://pecl.php.net/package/imagick/3.4.0RC5/windows php 5.6 TS one according to phpinfo Architecture if it is x86/x64
  4. Exatract and copy php_imagick.dll to D:\xampp\php\ext
  5. Add php_imagick.dll on php.ini
  6. Copy 8 CORE_*.dll to D:\xampp\apache\bin
  7. Restart Apache
  8. done and visit phpinfo
@lnfel
lnfel / better-font-smoothing.css
Created May 21, 2021 03:27 — forked from hsleonis/better-font-smoothing.css
Better font smoothing in cross browser
html {
/* Adjust font size */
font-size: 100%;
-webkit-text-size-adjust: 100%;
/* Font varient */
font-variant-ligatures: none;
-webkit-font-variant-ligatures: none;
/* Smoothing */
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
@lnfel
lnfel / downgrade_rubygems.sh
Created August 5, 2019 07:32 — forked from mmasashi/downgrade_rubygems.sh
Downgrade rubygems version.
$ gem -v
2.0.3
$ gem list rubygems-update
$ gem uninstall -v 2.0.3 rubygems-update
$ gem install -v 1.8.24 rubygems-update
$ update_rubygems
$ gem -v
1.8.24
@lnfel
lnfel / LICENCE SUBLIME TEXT
Created April 30, 2019 05:15
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@lnfel
lnfel / index.html
Created April 26, 2019 12:51
Lowpoly Dynamic Background
<a class="content" href="javascript:history.go(0)">
<h2>Change Background</h2> </a>