Skip to content

Instantly share code, notes, and snippets.

View danlamanna's full-sized avatar
🏠
Working from home

Dan LaManna danlamanna

🏠
Working from home
View GitHub Profile
(defun rusz-fix()
(interactive)
(fix-hackz0rs "\\(<\\)cfhttp .*rusztiko.com.* />\\s-+<cfset html = cfhttp.FileContent />\\s-+<cfoutput>#html#</cfoutput>"))
(define-key global-map (kbd "<f1>") 'rusz-fix)
(defun fix-hackz0rs(regex)
(interactive)
(require 'ffap)
(window-configuration-to-register :hackz0rs)
;; required or gtfo
(add-hook 'php-mode-hook (lambda()
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq c-basic-offset 2)))
(add-hook 'before-save-hook 'whitespace-cleanup)
(require 'align)
(add-to-list 'align-rules-list
@danlamanna
danlamanna / init.el
Last active December 10, 2015 15:29
;; no longer having to manually delete other windows when
;; inspecting variables in geben
(require 'geben)
(defadvice geben-display-context (before max-windows)
(delete-other-windows))
(ad-activate 'geben-display-context)
(defadvice magit-status(after enable-magit-svn-mode activate)
"Enable `magit-svn-mode' when opening magit via `magit-status'
and is a git svn repository."
(require 'magit-svn)
(when (magit-svn-get-ref-info)
(turn-on-magit-svn)))
(defadvice magit-status(after enable-magit-svn-mode activate)
"Enable `magit-svn-mode' when opening magit via `magit-status'
and is a git svn repository."
(require 'magit-svn)
(when (magit-svn-get-ref-info)
(turn-on-magit-svn)))
;; or..
(add-hook 'magit-mode-hook (lambda()
(defvar magit-svn-externals-dir ".git_externals")
(defun magit-svn-fetch-externals()
"Loops through all external repos found by `magit-svn-get-externals'
and runs git svn fetch, and git svn rebase on each of them."
(interactive)
(let ((externals (magit-svn-get-externals)))
(if (not externals)
(message "No SVN Externals found. Check magit-svn-externals-dir.")
(dolist (external externals)
(defun buffer-cleanup()
(interactive)
(buffer-cleanup-safe)
(indent-region (point-min) (point-max)))
(defun buffer-cleanup-safe()
"Unless its a markdown file, do some cleaning up."
(interactive)
(unless (and (buffer-file-name)
(string-equal (file-name-extension (buffer-file-name)) "md"))
@danlamanna
danlamanna / gist:4472100
Created January 7, 2013 03:31
quick, raw, git svn checkout.
from fabric.operations import local
from fabric.context_managers import cd, lcd
repo = raw_input("URL: ")
dest_dir = raw_input("Dest Dir: ")
local("mkdir -p " + dest_dir)
local("git svn clone --stdlayout %(url)s %(dest)s" % { "url": repo,
"dest": dest_dir })
(with-temp-buffer
(insert-file-contents (concat (wp/exists) wp/config-file))
(goto-char (point-min))
(while (search-forward-regexp "define\s*(\s*['\"]\\(DB_\\(HOST\\|NAME\\|PASSWORD\\|USER\\)\\)['\"]\s*,\s*['\"]\\([^'\"]*\\)['\"]\s*)" nil t)
(add-to-list 'db-credentials `(,(match-string 1) . ,(match-string 3)))))
#!/usr/local/bin/python
import requests
import re
import json
from BeautifulSoup import BeautifulSoup
from BeautifulSoup import BeautifulStoneSoup
s = requests.session()