Skip to content

Instantly share code, notes, and snippets.

@bean5
bean5 / gist:1245ecbb8976099daf5dcc8c2e76e8cd
Created June 7, 2021 15:11 — forked from jaxbot/gist:5748513
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}

Keybase proof

I hereby claim:

  • I am bean5 on github.
  • I am bean5 (https://keybase.io/bean5) on keybase.
  • I have a public key ASABJUh8P4Uq8YAEMAN9ZKlga1-HA-MIWO3DRHwpbcFP_wo

To claim this, I am signing this object:

@bean5
bean5 / commit-msg
Last active May 9, 2022 10:10 — forked from remi/commit-msg
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
@bean5
bean5 / regex
Created December 20, 2013 16:39
Locate variables that don't use scoping in CF.
((?:(<cfset\s*))([a-z][a-z0-9_\$]*)(?:(\s*=)))|(((<cfobject.*?name)|returnvalue|result)\s*=\s*['"][a-z][0-9a-z_\$]*['"])
@bean5
bean5 / regex
Created December 20, 2013 15:58
Find coldfusion functions that do not have either returntype, name, output, or access specified.
//doesn't specify access
<cffunction\s*(((name)|(hint)(output)|(returntype)|)\s*=\s*(['"]([a-z ]*)['"])\s*(access\s*(=\s*['"][a-z]?['"])?)?)*>
//doesn't specify name
<cffunction\s*(((access)|(hint)|(output)|(returntype))\s*=\s*(['"]([a-z ]*)['"])\s*(name\s*(=\s*['"][a-z]?['"])?)?)*>
//doesn't specify hint
<cffunction\s*(((access)|(name)|(output)|(returntype))\s*=\s*(['"]([a-z ]*)['"])\s*(hint\s*(=\s*['"][a-z]?['"])?)?)*>
//doesn't specify output
@bean5
bean5 / regex.txt
Last active December 30, 2015 09:49
regex to find ajax messages that are missing punctuation at end of sentence
ajax.message['"],.*[a-z\?\!]['"]\)
#!/bin/bash
# Disclaimer - make backups, use at your own risk.
#
# Based on this comment: http://stackoverflow.com/a/13944924/843067
# Views and stored procedures have to be done separately.
OLDDB="old_db_name"
NEWDB="new_db_name"
MYSQL="mysql -u root -pyour_password "
@bean5
bean5 / ignore-whitespace-in-side-by-side-diff.js
Last active December 28, 2015 23:49
ignore whitespace in bb
function removeEmptys() {
$body = $('body');
$body.html($body.html().replace(/<del>(\s*)<\/del>/, '$1'));
$body.html($body.html().replace(/<ins>(\s*)<\/ins>/, '$1'));
//@TODO: Remove additions/deletions that are marked but don't need to be
}
//TODO implement removeEmptyParents()
function removeEmptyParents() {