This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SOLERIZED='{ | |
"Ansi 0 Color" = { | |
"Blue Component" = 0.19370138645172119; | |
"Green Component" = 0.15575926005840302; | |
"Red Component" = 0.0; | |
}; | |
"Ansi 1 Color" = { | |
"Blue Component" = 0.14145714044570923; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
} | |
function get_pwd() { | |
print -D $PWD | |
} | |
function put_spacing() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file = 'http://www.example.com/path/to/file.ext'; | |
$headers = array_change_key_case(get_headers($file, TRUE)); | |
$filesize = $headers['content-length'][1]; | |
if ( $headers[0] != 'HTTP/1.1 404 Not Found' ) { | |
header('Content-Description: File Transfer'); | |
header('Content-Type: application/octet-stream'); | |
header('Content-Disposition: attachment; filename='.basename($file)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# A hook script to export your database on every commit. | |
# | |
# The export is saved to a temp file. If the export | |
# fails, the file is trashed. Otherwise it overwrites the tracked file. | |
# | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This hook will append the current branch name to | |
# the commit message if it's not already there. | |
ref=$(git symbolic-ref HEAD 2> /dev/null) | |
branch=${ref#refs/heads/} | |
if [[ "$branch" != "master" ]]; then | |
grep -qa "$branch" "$1" || echo "\n[Branch: $branch]" >> "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Disable plugins when doing local dev | |
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# How to use this file: | |
# | |
# 1. Clone/copy this gist into the .git/hooks directory | |
# 2. Enter the website's domain and server's admin username in the variables | |
# 3. Make the file executable using: $ chmod +x post-merge | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options +FollowSymlinks -MultiViews | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_URI} !articles\.html [NC] | |
RewriteCond %{REQUEST_URI} ^/articles/([^/]+)/? [NC] | |
RewriteRule .* /articles.html#%1 [R,NE,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is a list of useful commands and one-liners to make | |
# life on the command line easier | |
# | |
# Create complex directory structures | |
$ mkdir -p project/{lib/ext,bin,src,doc/{html,info,pdf},demo/stat/a} | |
# Option -C to unpack a .tar archive file to a location | |
$ tar xvf -C tmp/a/b/c newarc.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apply a patch from another (unrelated) local repository | |
$ git --git-dir=../some_other_repo/.git format-patch -k -1 --stdout <commit SHA> | git am -3 -k | |
# Checout an empty branch to do something radically different (i.e. gh-pages) | |
$ git checkout --orphan <new_empty_branch> | |
# Find the root of the project | |
$ git rev-parse --show-toplevel | |
# Change to the root of the project |
OlderNewer