Skip to content

Instantly share code, notes, and snippets.

View raisiqueira's full-sized avatar
👽
learning something new!

Raí Siqueira raisiqueira

👽
learning something new!
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 28, 2025 06:24
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@stephenway
stephenway / cors-conf.xml
Created September 13, 2015 04:52
Amazon S3 Directory Listing for Web Fonts
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
@vedovelli
vedovelli / gist:cd6b9a99e2ba9ebaaa98
Created June 22, 2015 23:23
Install Sublime Text 2 apt-get
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text
@ericandrewlewis
ericandrewlewis / gist:95239573dc97c0e86714
Last active September 11, 2024 17:10
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@zergiocosta
zergiocosta / custom_error_msgs.php
Last active September 3, 2020 15:43
Changing login error message (wp-admin)
<?php
// Insert into your functions.php and have fun by creating login error msgs
function guwp_error_msgs() {
// insert how many msgs you want as array items. it will be shown randomly (html is allowed)
$custom_error_msgs = [
'<strong>YOU</strong> SHALL NOT PASS!',
'<strong>HEY!</strong> GET OUT OF HERE!',
];
// get and returns a random array item to show as the error msg
return $custom_error_msgs[array_rand($custom_error_msgs)];
@3runoDesign
3runoDesign / Procfile
Last active March 3, 2022 14:09
Deploy Heroku [Laravel 5.2.*]
web: sh app_boot.sh
worker: php artisan queue:listen
@vinicius73
vinicius73 / Common.php
Last active August 29, 2015 14:20
Repo Base
<?php namespace App\Contracts\Repositories\Segregated;
use Illuminate\Database\Eloquent\Model;
interface Common
{
/**
* @param bool $paginate
* @param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder $query
@claudiosanches
claudiosanches / test.php
Last active April 8, 2025 20:36
Regex for test credit card brand
<?php
// Test cards
$cards = array(
'378282246310005', // American Express
'371449635398431', // American Express
'5078601870000127985', // Aura
'5078601800003247449', // Aura
'30569309025904', // Diners Club
'38520000023237', // Diners Club
@vluzrmos
vluzrmos / README.md
Last active August 29, 2015 14:19
Laravel Lumen CORS Middleware
@jonasthomaz
jonasthomaz / exemplo_paginacao.php
Last active August 29, 2015 14:16
Paginação com slimframework + twig + eloquent (exemplo)
<?php
//Rota de Paginaçnao
/**
* Rotina recebe o parametro $pagina para poder realizar a paginação
**/
$application->get('/minharota/:pagina', function ($pagina) use ($twig_engine) {
$registros_por_pagina=20;
$meusdados = Capsule::table('minhatabela')->skip($registros_por_pagina*$pagina)->take($registros_por_pagina)->get();