Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Dale Ryan lnfel

🏠
Working from home
View GitHub Profile
@lnfel
lnfel / Update-branch.md
Created December 21, 2022 11:26 — forked from whoisryosuke/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.
View Update-branch.md

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@lnfel
lnfel / ffmpeg_install_latest.md
Created December 15, 2022 00:56 — forked from teocci/ffmpeg_install_latest.md
Easy way to convert MKV to MP4 with ffmpeg
View ffmpeg_install_latest.md

How to install FFmpeg on Ubuntu

FFmpeg is a free and open source command line tool for transcoding multimedia files. It contains a set of shared audio and video libraries such as: libavcodec, libavformat, and libavutil. With this tool, you can convert between various video and audio formats, set sample rates and resize videos.

In this document will show you how to install a stable version and the latest version of FFmpeg. This instructions apply for any Ubuntu based distribution, including Linux Mint and Elementary OS.

Prerequisites

In order to be able to add new repositories and install packages on your Ubuntu system, you must be logged in as a user with sudo privileges.

Installing FFmpeg 4.x on Ubuntu

@lnfel
lnfel / fb.js
Created November 9, 2021 02:52 — forked from koistya/fb.js
Lazy loader for Facebook JavaScript SDK / Customer Chat SDK https://medium.com/p/5b7c21343048/
View fb.js
import loadScript from 'load-script';
let initialized = false;
let queue = [];
export function fb(callback) {
if if (initialized) {
callback(window.FB);
} else {
queue.push(callback);
@lnfel
lnfel / revert-a-faulty-merge.txt
Created October 18, 2021 01:07
Revert a faulty merge
View revert-a-faulty-merge.txt
source: https://mirrors.edge.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt
stackoverflow: https://stackoverflow.com/questions/1078146/re-doing-a-reverted-merge-in-git
Date: Fri, 19 Dec 2008 00:45:19 -0800
From: Linus Torvalds <torvalds@linux-foundation.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: Odd merge behaviour involving reverts
Abstract: Sometimes a branch that was already merged to the mainline
is later found to be faulty. Linus and Junio give guidance on
recovering from such a premature merge and continuing development
after the offending branch is fixed.
@lnfel
lnfel / .htaccess
Created October 15, 2021 02:25
Enable Gzip compression in Laravel assets #laravel #php
View .htaccess
<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
View memory_usage.php
<?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
View REST API.md

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 — создать нового пользователя;
View MailTracking.php
<?php
namespace Tests;
use Mail;
use Swift_Message;
use Swift_Events_EventListener;
trait MailTracking
{
/**
* Delivered emails.
@lnfel
lnfel / .htaccess
Created September 7, 2021 04:46 — forked from morcegon/.htaccess
.htaccess optimized for laravel
View .htaccess
# 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.
View heroku_pg:push_workaround.md

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: