Skip to content

Instantly share code, notes, and snippets.

View gabeidx's full-sized avatar

Gabriel Silva (Gabe) gabeidx

View GitHub Profile
@gabeidx
gabeidx / _document.tsx
Created January 14, 2021 12:32
NextJS custom _document
import { default as React } from 'react';
import { default as Document, Html, Head, Main, NextScript } from 'next/document';
// We need to duplicate the type definition for `DocumentFiles` here because nextjs
// does not export it from 'next/document'
type DocumentFiles = {
sharedFiles: readonly string[];
pageFiles: readonly string[];
allFiles: readonly string[];
};

Keybase proof

I hereby claim:

  • I am gabrielizaias on github.
  • I am gabeidx (https://keybase.io/gabeidx) on keybase.
  • I have a public key ASDOvvG6Z42JPb5Orq47K_l1isRMhoV9xkChnILzZpCt4go

To claim this, I am signing this object:

{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "~3.0",
"mobiledetect/mobiledetectlib": "2.*",
@gabeidx
gabeidx / .gitconfig
Last active August 29, 2015 14:03
My current .gitconfig
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# View the current working tree status using the normal format
st = status
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
@gabeidx
gabeidx / gist:9058847
Created February 17, 2014 20:50
Git post-update hook
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@gabeidx
gabeidx / dotfiles-cleanup.sh
Created December 21, 2013 19:10
Remove dotfiles archives from ~/
for source in `find $HOME/dotfiles -maxdepth 1 -type f`; do
dest="$HOME/`basename $source`"
if [ -f $dest ] || [ -d $dest ]; then
rm -rfv $dest
fi
done
@gabeidx
gabeidx / browser-1.2.0.js
Last active December 19, 2015 11:59
Browser detection
/* Browser 1.2.0 | @gabrielizaias | MIT/GPL2 Licensed */
(function () {
'use strict';
var b = navigator.userAgent.toLowerCase(),
e = document.getElementsByTagName('html')[0],
c = b.indexOf('macintosh') !== -1 ? 'macintosh' : b.indexOf('windows') !== -1 ? 'windows' : b.indexOf('linux') !== -1 ? 'linux' : undefined,
a = /(chrome)(?:.*chrome)?[ \/]([\w.]+)/.exec(b) || /(safari)(?:.*version)?[ \/]([\w.]+)/.exec(b) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(b) || /(ie) ([\w.]+)/.exec(b) || !/compatible/.test(b) && /(firefox)(?:.*firefox)?[ \/]([\w.]+)/.exec(b) || [],
f = e.className.split(' ');
f.push(a[1], a[1]+parseInt(a[2], 10), c, navigator.platform)
e.className = f.join(' ').replace(/^[\s\xA0]+|[\s\xA0]+$/g, '');
@gabeidx
gabeidx / jquery.liveFilter.js
Created September 18, 2012 11:30
Filter table rows as you type on a input field.
/**
* Filter table rows as you type
*
* == How to use ==
* Just add the script to the page and, on the input element,
* add the data-filter attibute with the selector to the table.
* <input type="search" data-filter="#tableID">
*
* == Acknowledgements ==
* This was inspired by jresig's liveUpdate plugin used on jQuery's