Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Stay well, Stay home

Bruno Fernando dos Santos Silva 3runoDesign

🏡
Stay well, Stay home
View GitHub Profile
@alieslamifard
alieslamifard / withPrivateRoute.jsx
Last active Nov 28, 2020
Private route HOC for Next.js
View withPrivateRoute.jsx
import React from 'react';
import Router from 'next/router';
const login = '/login?redirected=true'; // Define your login route address.
/**
* Check user authentication and authorization
* It depends on you and your auth service provider.
* @returns {{auth: null}}
*/
View BulmaWalker.php
<?php
namespace App\Lib;
use Utils;
class BulmaWalker extends \Walker_Nav_Menu
{
private $cpt; // CPT, is current post a custom post type
private $archive; // Stores the archive page for current URL
public function __construct()
@lucasprogamer
lucasprogamer / main.js
Created May 21, 2018
CF7 Bulma Ajax-loader icon
View main.js
/**
* when cf7 ajax-loader
* @param {[type]} form [description]
* @return {[type]} [description]
*/
wpcf7.submit = function( form ) {
if ( typeof window.FormData !== 'function' ) {
return;
}
@avataru
avataru / EloquentCheatSheet.md
Last active Dec 4, 2020
Eloquent relationships cheat sheet
View EloquentCheatSheet.md
@lucasprogamer
lucasprogamer / WP .htacess cache controll
Last active Oct 30, 2017
Add after # END WordPress.
View WP .htacess cache controll
#Força a utilizar Cache-Control e Expires header
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Html
@3runoDesign
3runoDesign / README.md
Last active Jan 12, 2019
Convert RAW to JPG
View README.md

Sheel para converter fotos .CR2 para .jpeg

@CodeVachon
CodeVachon / gulpfile.babel.js
Last active Nov 25, 2017
React Setup with Babel, Gulp, and Browserify
View gulpfile.babel.js
import gulp from 'gulp';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import eslint from 'gulp-eslint';
import exorcist from 'exorcist';
import browserSync from 'browser-sync';
import watchify from 'watchify';
import babelify from 'babelify';
import uglify from 'gulp-uglify';
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active Oct 18, 2020
Laravel 5 Simple ACL - Protect routes by an account / role type
View 01_Laravel 5 Simple ACL manager_Readme.md

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@timkinnane
timkinnane / dynamic_image_downsize.php
Created Feb 2, 2015
Filter the output of image_downsize() to return dynamically generated images for intermediate or inline sizes. Long description in php doc block.
View dynamic_image_downsize.php
<?php
/**
* Filter the output of image_downsize() to return dynamically generated images for intermediate or inline sizes.
*
* <p>Because Wordpress generates all image sizes on first upload, if you change
* theme or size settings after the upload, there won't be a matching file for
* the requested size.<br/>
* This filter addresses the problem of the default downsize process laoding
* a large file and scaling it down in the browser if it doesn't find the right
* size image. This can cause large files to be loaded unnecessarily and will
@wkw
wkw / WordPress On-Demand Custom Image Sizes
Created Aug 7, 2014
Add this to your WordPress functions.php if you are using many custom image sizes (add_image_size(...)) to prevent the creation of all the sizes upon image upload. This will only generate a custom size the first time it is requested.
View WordPress On-Demand Custom Image Sizes
/* ======================================================================================
//! -- On Demand Image Sizing --
Experimental code for generating custom image sizes on demand.
http://wordpress.stackexchange.com/a/124790
From the author...
"When an image is then requested in a particular size,
which is not yet generated, it will be created only that once."
====================================================================================== */
You can’t perform that action at this time.