Skip to content

Instantly share code, notes, and snippets.

Alberto De Lucca adeluccar

Block or report user

Report or block adeluccar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adeluccar
adeluccar / pnpm.zsh
Created Aug 9, 2017 — forked from danielbayley/pnpm.zsh
A binstub to seamlessly alias @npm to @pnpm.
View pnpm.zsh
#! /bin/zsh -f
disable which # builtin
alias -g i=install
pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }
if (which -s pnpm) npm () {
NODE_BIN=`brew --prefix node`/bin
export PATH=$PATH:$NODE_BIN
@adeluccar
adeluccar / gist:d105299f2d5af55e3e96f9b989e7eb48
Created Aug 8, 2017
How to Flatten the History of a Git Repository Safely
View gist:d105299f2d5af55e3e96f9b989e7eb48
git checkout --orphan future-master
git add -A  # Add all files and commit them
git commit
git branch -D master  # Deletes the master branch
git branch -m master  # Rename the current branch to master
git push -f origin master  # Force push master branch to github
git gc --aggressive --prune=all     # remove the old files
@adeluccar
adeluccar / README.md
Created Aug 1, 2017 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods
View README.md

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@adeluccar
adeluccar / .tern-project
Created Jul 17, 2017 — forked from nisaacson/.tern-project
Use tern with vim for node.js development.
View .tern-project
{
"libs": [
"browser",
"underscore",
"jquery"
],
"plugins": {
"node": {}
}
}
@adeluccar
adeluccar / GIF-Screencast-OSX.md
Created Jul 11, 2017 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@adeluccar
adeluccar / create-project.sh
Created Jul 11, 2017 — forked from jasonlewis/create-project.sh
Bash script that creates a new project and virtual host for that project. Can also be used to quickly create a new Laravel project.
View create-project.sh
#!/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() {
@adeluccar
adeluccar / grepping.md
Created Jun 30, 2017 — forked from manasthakur/grepping.md
Vim: Creating your own ack.vim/ag.vim
View grepping.md

Creating your own ag.vim

Vim provides built-in mechanisms to search through projects in the form of the grep command. However, on large projects, grep is known to be slow; and hence people have been switching to simpler searchers like ack, and faster, parallel (metal?) searchers like ag and pt. Correspondingly, several plugins have been created that integrate these tools in vim: ack.vim, ag.vim, etc.

However, it's actually very easy to get the functionalities these plugins provide (faster search, results in quickfix-window, jumps, previews, and so on) in vanilla Vim itself; in fact, Vim already populates the grep-search results in a quickfix window. We just need to tell Vim to do the following things (use-case: ag):

  • Use ag as the default grep program
  • Open quickfix window by default
  • Create mappin
@adeluccar
adeluccar / submodules.md
Created Jun 28, 2017 — forked from manasthakur/submodules.md
Using git submodules to version-control Vim plugins
View submodules.md

Using git-submodules to version-control Vim plugins

If you work across many computers (and even otherwise!), it's a good idea to keep a copy of your setup on the cloud, preferably in a git repository, and clone it on another machine when you need. Thus, you should keep the .vim directory along with your .vimrc version-controlled.

But when you have plugins installed inside .vim/bundle (if you use pathogen), or inside .vim/pack (if you use Vim 8's packages), keeping a copy where you want to be able to update the plugins (individual git repositories), as well as your vim-configuration as a whole, requires you to use git submodules.

Creating the repository

Initialize a git repository inside your .vim directory, add everything (including the vimrc), commit and push to a GitHub/BitBucket/GitLab repository:

cd ~/.vim
@adeluccar
adeluccar / web-servers.md
Created Jun 21, 2017 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@adeluccar
adeluccar / wp.sh
Created May 20, 2017 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
View wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
You can’t perform that action at this time.