Skip to content

Instantly share code, notes, and snippets.

View gomezcabo's full-sized avatar

Juan Gómez gomezcabo

  • Tenerife, España
View GitHub Profile
@gomezcabo
gomezcabo / storage-polyfill.js
Created March 28, 2019 09:38 — forked from ghinda/gist:6036998
local/session storage polyfill (@Rem's version + with support for opera mini)
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@gomezcabo
gomezcabo / slugify.js
Created March 14, 2019 10:31 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
function my_git_prompt() {
tester=$(git rev-parse --git-dir 2> /dev/null) || return
INDEX=$(git status --porcelain 2> /dev/null)
STATUS=""
# is branch ahead?
if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
@gomezcabo
gomezcabo / angryflip
Last active November 20, 2017 08:40
Flip commands ¯\_(ツ)_/¯
#!/usr/bin/perl
use utf8;
use Data::Dumper;
if ($#ARGV + 1 < 1) {
print "\nUsage: angryflip something_to_flip\n";
exit;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>One file React.js</title>
</head>
<body>
<div id="root"></div>
@gomezcabo
gomezcabo / cloudSettings
Last active January 29, 2018 10:49
Visual Studio Code Sync Settings GIST
{"lastUpload":"2018-01-29T10:49:48.875Z","extensionVersion":"v2.8.7"}