Skip to content

Instantly share code, notes, and snippets.

@adeluccar
adeluccar / anki.css
Last active August 29, 2015 14:11 — forked from zabbarob/anki.css
@font-face {
font-family: junicode;
src: url('_junicode.ttf');
}
.card, table {
font-family: Helvetica, sans-serif, junicode;
font-size: 20px;
text-align: center;
color: #d03030;
background-color: #fafaf5;
# Credit to http://www.iarp.ca/hobby/computing/36-git-committed-and-pushed-to-the-incorrect-branch
# Ensure you're in the branch that you commited to by accident.
git checkout master
# Reset the branch back one commit.
git reset --soft HEAD^
# Stash the changes
git stash
@adeluccar
adeluccar / gem-reset
Last active August 29, 2015 14:22 — forked from nixpulvis/gem-reset
#!/usr/bin/env ruby
# Remove all gems EXCEPT defaults :)
`gem list -d`.split(/\n\n^(?=\w)/).each do |data|
match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/)
name = match[:name]
versions = match[:versions].split(', ')
if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/)
next if match[1].empty? # it's the only version if this match is empty
@adeluccar
adeluccar / README-Template.md
Created June 4, 2016 19:19 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisities

@adeluccar
adeluccar / cask_upgrade.sh
Created February 2, 2017 22:32
Script upgrading outdated brew casks
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
@adeluccar
adeluccar / wp_custom_install.sh
Created March 24, 2017 17:21 — forked from davidwolfpaw/wp_custom_install.sh
A starter script for creating a WordPress site on Vagrant using VVV, VV, VASSH, and WP-CLI
#!/bin/bash -e
# Ideas, Drawbacks, and Suggestions: https://davidlaietta.com/bash-scripting-to-automate-site-builds-with-wp-cli/
# Set up some defaults
wpuser='USERNAME'
email='USER@EMAIL.COM'
blueprint='BLUEPRINT-NAME'
clear
@adeluccar
adeluccar / web-servers.md
Created June 21, 2017 01:16 — forked from willurd/web-servers.md
Big list of http static server one-liners

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 / submodules.md
Created June 28, 2017 01:46 — forked from manasthakur/submodules.md
Using git submodules to version-control Vim plugins

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 / grepping.md
Created June 30, 2017 06:24 — forked from manasthakur/grepping.md
Vim: Creating your own ack.vim/ag.vim

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 / create-project.sh
Created July 11, 2017 05:34 — 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.
#!/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() {