Skip to content

Instantly share code, notes, and snippets.

View leandroruel's full-sized avatar

Leandro RR leandroruel

View GitHub Profile

Esconder console.log() para o site em produção

  • Trocar o www.mywebsite.com pelo endereço do site em produção;
  • Incluir isso no início do seu script.

Se passar o parâmetro ?development na URL, ele ignora e mostra os console.log().

@leandroruel
leandroruel / container-segue-altura-conteudo
Last active August 29, 2015 13:56
com o uso de CSS o código cria um container "seguidor" do conteúdo da página, o elemento vai do topo ao rodapé mesmo com pouco ou nenhum conteúdo.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*,
*::after,
*::before {
box-sizing: border-box;

Contrato Arrasador 3

Atualizado em: 11/07/2012

Entre nós [nome da empresa] e você [nome do cliente]

Sumário:

Nós faremos o melhor para satisfazer suas necessidades e atender suas expectativas, mas é importante registrar tudo por escrito para que todos conheçam suas responsabilidades (quem faz o quê) e saibam o que acontece quando algo dá errado. Neste contrato você não encontrará termos jurídicos complicados ou textos longos e incompreensíveis. Nós não temos interesse em fazê-lo assinar algo que poderá se arrepender depois. O que nós queremos é o melhor para os dois lados, agora e no futuro.

// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@leandroruel
leandroruel / Handler.php
Last active January 12, 2018 19:28
App\Exceptions\Handler.php
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
@leandroruel
leandroruel / http-error.js
Created May 21, 2018 17:08 — forked from TooTallNate/http-error.js
HTTPError class for JavaScript HTTP errors
import { format } from 'url';
import { STATUS_CODES } from 'http';
import uppercamelcase from 'uppercamelcase';
class HTTPError extends Error {
constructor(code, message, extras) {
super(message || STATUS_CODES[code]);
if (arguments.length >= 3 && extras) {
Object.assign(this, extras);
}
@leandroruel
leandroruel / .env
Created January 17, 2018 16:32
this gist constains the database.php and .env file example of multiple connections
DB_CONNECTION=mysql
DB_HOST=http://localhost
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=root
DB_PASSWORD=
DB_CONNECTION2=mysql
DB_HOST2=http://localhost
DB_PORT2=3306
@leandroruel
leandroruel / createDinamicallyElement.js
Last active June 4, 2018 15:07
function to create dinamically a element, first parameter, the tag name and the second a object of attributes { key: value }
// check if the attribute key is camelcase
const isCamelCase = (str) => {
return /[A-Z]/.test(str)
}
//change the attribute from camelcase to hyphen separator
const changeSeparator = (str) => {
return str.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase();
}
@leandroruel
leandroruel / gist:848370c0e133de40b9923b332b481bc3
Created June 22, 2016 16:52 — forked from tarciozemel/gist:1884583
JavaScript: incluir arquivos js/css dinamicamente
/*
* Ex:
* include("http://mysite.com/bookmarklet.css");
* include("http://mysite.com/bookmarklet.js");
*/
let include = ( src, callback ) => {
let ext = src.split( /[\#\?]/ )[ 0 ].split( '.' ).pop().toLowerCase();
let inc;
if ( ext === 'css' ) {
@leandroruel
leandroruel / CloneController.php
Last active July 20, 2019 20:39
creates a clone of a model and his relationships
<?php namespace App\Http\Controllers;
use App\MyModel;
class CloneController extends Controller
{
/**
* Replicate a model and his relationships
*
* @param $id