Skip to content

Instantly share code, notes, and snippets.

@LuenCC
LuenCC / .php-cs-fixer.php
Created September 1, 2023 03:01 — forked from laravel-shift/.php-cs-fixer.php
Pint PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@LuenCC
LuenCC / README.md
Created October 26, 2018 16:33 — forked from hofmannsven/README.md
Nginx proxy configuration for Google Analytics

Google Analytics Nginx Proxy

Google PageSpeed Insights flags browser caching of Google Analytics:

Leverage browser caching

Set up a proxy in your Nginx configuration file to address this issue.

Source

@LuenCC
LuenCC / helper.php
Created October 22, 2018 02:41
Assets path manifest.json
function asset_path($filename) {
$manifest_path = '../dist/rev-manifest.json';
if (file_exists($manifest_path)) {
$manifest = json_decode(file_get_contents($manifest_path), TRUE);
} else {
$manifest = [];
}
if (array_key_exists($filename, $manifest)) {
@LuenCC
LuenCC / README.md
Created October 19, 2018 02:48 — forked from hofmannsven/README.md
My simply Git Cheatsheet
All Autocomplete
AutoFileName
Blade Snippets
BracketHighlighter
ColorPicker
DocPHPManualer
Emmet
jQuery
Laravel 5 Artisan
Laravel Blade Highlighter
@LuenCC
LuenCC / accordion-shortcode.php
Created June 3, 2018 00:47 — forked from rahulsprajapati/accordion-shortcode.php
Custom Shortcode UI Functionality: TinyMce And Repeater
<?php
/**
* Accordion ShortCode.
*
* @param array $accordion_attrs Accordion ShortCode attribute.
*
* @return string
*/
function accordion_register_shortcode( $accordion_attrs ) {
@LuenCC
LuenCC / AWS Git Setup.md
Last active May 6, 2018 06:55 — forked from matthewoden/AWS Git Setup.md
Setting up a remote Git in AWS EC2

git --work-tree=/var/www/momentun --git-dir=/var/repo/sitemomentun.git checkout -f

AWS Remote Git Setup

Get a local git repo up on an EC2 Instance.

Add youself to SSH Authentication:

Add yourself to the ssh auth agent, if you haven't already.

ssh-add path/to/your/EC2.pem
@LuenCC
LuenCC / Laravel PHP7 LEMP AWS.md
Last active May 6, 2018 07:44 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7.1 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
#!/bin/sh
echo "Start Auto Deployment"
git --work-tree=//computer-name/deployment --git-dir=//computer-name/myrepo checkout -f
echo "Deployment Finished"
@LuenCC
LuenCC / gist:e8dcf4a38096617799f3002644012af6
Created October 6, 2016 21:26
Laravel find nearest location in km from lat, long database
private function findNearestLocation(Request $request)
{
$location = DB::table('locations')
->select('name', 'latitude', 'longitude', 'region', DB::raw(sprintf(
'(6371 * acos(cos(radians(%1$.7f)) * cos(radians(latitude)) * cos(radians(longitude) - radians(%2$.7f)) + sin(radians(%1$.7f)) * sin(radians(latitude)))) AS distance',
$request->input('latitude'),
$request->input('longitude')
)))
->having('distance', '<', 50)
->orderBy('distance', 'asc')