Skip to content

Instantly share code, notes, and snippets.

View phaberest's full-sized avatar
🌎
On a world tour as digital nomad

Luca Sartori phaberest

🌎
On a world tour as digital nomad
View GitHub Profile
@phaberest
phaberest / ie_includes_polyfill.js
Created January 18, 2019 17:36
Polyfill for js es2015 includes
// includes() polyfill for strings
if (!String.prototype.includes) {
String.prototype.includes = function(search, start) {
'use strict';
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > this.length) {
return false;
@phaberest
phaberest / mac_tricks.sh
Last active October 17, 2018 19:42
Mac defaults hacks
# Reduce dock show/hide time
defaults write com.apple.dock autohide-delay -int 0
defaults write com.apple.dock autohide-time-modifier -float 0.4
killall Dock
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 10
# Screeshots in jpg
@phaberest
phaberest / helpers.php
Last active September 20, 2016 13:57
[PHP] Array to XML
private function arrayToXML($data, &$xml)
{
foreach ($data as $key => $value) {
if (is_array($value)) {
if (is_numeric($key)) {
$key = 'item'.$key; //dealing with <0/>..<n/> issues
}
$subnode = $xml->addChild($key);
array_to_xml($value, $subnode);
} else {
@phaberest
phaberest / .vimrc
Created March 7, 2016 15:48
Terminal basic vimrc
set encoding=utf8
set autoread
set backspace=indent,eol,start
set nu
set showcmd
set cursorline
set incsearch
set hlsearch
set lazyredraw
set showmatch
@phaberest
phaberest / .vimplugins.vim
Last active February 3, 2016 17:22
My new vim configuration
" Setting up plug - the vim plugin bundler
let PlugIsInstalled=1
let plugfile=expand('~/.vim/autoload/plug.vim')
if !filereadable(plugfile)
echo "Installing Plug..."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let PlugIsInstalled=0
endif
@phaberest
phaberest / .vimrc
Created October 22, 2013 00:29 — forked from JeffreyWay/.vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {
@phaberest
phaberest / CSS Scrollbars IE
Created April 9, 2013 12:04
Style scrollbars in IE with simple CSS
body {
scrollbar-arrow-color: #FF3300;
scrollbar-3dlight-color: #FF6633;
scrollbar-highlight-color: #FF9933;
scrollbar-face-color: #FF9900;
scrollbar-shadow-color: #FF6633;
scrollbar-darkshadow-color: #FF0033;
scrollbar-track-color: #FF6600;
}
@phaberest
phaberest / CSS Scrollbars webkit
Created April 9, 2013 11:59
CSS Styled scrollbars on webkit
/* For the "inset" look only */
html {
overflow: auto;
}
body {
position: absolute;
top: 20px;
left: 20px;
bottom: 20px;
right: 20px;
@phaberest
phaberest / gist:bee213c6fb1a60ab7283
Created September 9, 2015 12:38
How to change the compose key on ubuntu
dconf write /org/gnome/desktop/input-sources/xkb-options "['compose:{key}']"