Skip to content

Instantly share code, notes, and snippets.

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

Felix Barros soyFelixBarros

🏠
Working from home
View GitHub Profile
@kengoldfarb
kengoldfarb / install_nginx_pagespeed_php.sh
Last active January 8, 2019 20:17
Nginx 1.6.0 - Pagespeed - PHP-FPM 5.5.x Installation
#!/bin/bash
## Author: Ken Goldfarb <hello@kengoldfarb.com>
## https://github.com/kengoldfarb
##
## This script will install Nginx+Pagespeed with PHP-FPM 5.5.x
## It's testsed working on a stock AWS Ubuntu 14.04 image
##
## BONUS: Oh-my-zsh installation included!
@justincarroll
justincarroll / bootstrap-masonry-template.htm
Last active August 15, 2020 16:48
This is my template for using Masonry 3 with Bootstrap 3. For those of you who follow this gist a lot has changed since Bootstrap 2.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">
@danharper
danharper / a.md
Last active September 2, 2020 17:13
Laravel Queue Supervisor

Install Supervisor with sudo apt-get install supervisor. Ensure it's started with sudo service supervisor restart.

In /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread. And start using those changes with: sudo supervisorctl update.

@vosidiy
vosidiy / basic.html
Last active September 2, 2020 18:15
Basic hover navbar
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main_nav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="main_nav">
<ul class="navbar-nav">
<li class="nav-item active"> <a class="nav-link" href="#">Home </a> </li>
<li class="nav-item"><a class="nav-link" href="#"> About </a></li>
<li class="nav-item"><a class="nav-link" href="#"> Services </a></li>
@junkystu
junkystu / laravel-forge-deployment-script.sh
Last active May 23, 2021 05:18
Script for quicker deployment with Laravel and Forge
# The idea of this deployment script is to create a deploy copy of your website and handle
# Git and Composer updates in there. Aferwards, it just renames that deploy copy to become the
# live website. We then run the database migrations and take the application out of maintenance mode.
# Obviously, you will have to replace all instances of {{ websiteName }} with the name of your website and
# {{ branchName }} with the name of the branch you would like to pull changes from. This is usually the master branch.
# Start by checking for for old deployment folder and remove it if we have one.
if [ -d "/home/forge/{{ websiteName }}-deploy" ]; then
rm -Rf /home/forge/{{ websiteName }}-deploy
// Add this to the "boot()" method of your "AppServiceProvider"
<?php
\Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) {
return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : '');
});
@slavafomin
slavafomin / ForcedLogoutListener.php
Last active September 4, 2022 17:59
Logging user out of Symfony 2 application using kernel event listener
<?php
namespace App\Security;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@reedmaniac
reedmaniac / nginx.conf
Created December 16, 2015 05:23
nginx.conf for Laravel Forge with SSL + Gzip
user forge;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
}
http {
@hslaszlo
hslaszlo / get-first-category.php
Last active August 29, 2023 10:18
Get first category name or id from wordpress post
<?php
// in the loop
$category = get_the_category();
$currentcat = $category[0]->cat_ID;
$currentcatname = $category[0]->cat_name;
$currentcatslug = $category[0]->slug;
// outside the loop
global $post;
$categories = get_the_category($post->ID);
@Tucker-Eric
Tucker-Eric / generate.sh
Created February 16, 2017 18:06
Script to generate nginx config
SED=`which sed`
CURRENT_DIR=`dirname $0`
echo "What is the domain?"
read DOMAIN
# check the domain is valid!
PATTERN="^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$";
if [[ "$DOMAIN" =~ $PATTERN ]]; then
DOMAIN=`echo $DOMAIN | tr '[A-Z]' '[a-z]'`