Skip to content

Instantly share code, notes, and snippets.

View brcontainer's full-sized avatar
👽
Try Inphinit PHP framework today!

Guilherme Nascimento brcontainer

👽
Try Inphinit PHP framework today!
View GitHub Profile
@wallacemaxters
wallacemaxters / jotEvent.js
Last active May 9, 2018 16:59
Sugestão de manipulação de events para a biblioteca https://github.com/brcontainer/jot.js
(function (window) {
"use strict";
var forEach = Array.prototype.forEach;
var Event = function (nodeList) {
this.nodeList = nodeList;
};
var proto = Event.prototype;
@wallacemaxters
wallacemaxters / Routing.py
Created November 4, 2016 17:43
provides a classes for easy routing with python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
class NotMatchingException(Exception):
pass
"""
This class represente a route
"""
@wallacemaxters
wallacemaxters / global.php
Last active May 18, 2016 13:18
Sistema de envio de relatório/log de erro com e-mail no Laravel 4
<?php
// Substituir `App::error` pelo código abaixo:
App::error(function (Exception $exception, $code) {
// Se a aplicação estiver no "local" ou erro for "página não encontrada", não envia
if ($code === 404 || App::isLocal()) return;
//Log::error($exception);
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@leabdalla
leabdalla / laravel-windows-server-iis.md
Created August 1, 2013 21:43
How to use Laravel in Windows IIS

Laravel 4 in Windows Server IIS

###1. Put this web.config in laravel root diretory

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
		<defaultDocument>
 
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
@glagola
glagola / gist:3942156
Created October 23, 2012 22:32
Распознавание кодировки строки
<?php
function detect_encoding($string, $pattern_size = 50)
{
$list = array('cp1251', 'utf-8', 'ascii', '855', 'KOI8R', 'ISO-IR-111', 'CP866', 'KOI8U');
$c = strlen($string);
if ($c > $pattern_size)
{
$string = substr($string, floor(($c - $pattern_size) /2), $pattern_size);
$c = $pattern_size;
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@dsingleton
dsingleton / function-bind.js
Created October 25, 2011 11:10
Polyfill for Function.prototype.bind
Function.prototype.bind=Function.prototype.bind||function(b){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");}var a=Array.prototype.slice,f=a.call(arguments,1),e=this,c=function(){},d=function(){return e.apply(this instanceof c?this:b||window,f.concat(a.call(arguments)));};c.prototype=this.prototype;d.prototype=new c();return d;};
@bobslaede
bobslaede / modernizr.positionfixed.js
Created September 16, 2011 08:50
Modernizr position fixed check
;(function(Modernizr, window) {
Modernizr.addTest('positionfixed', function () {
var test = document.createElement('div'),
control = test.cloneNode(false),
fake = false,
root = document.body || (function () {
fake = true;
return document.documentElement.appendChild(document.createElement('body'));
}());