Skip to content

Instantly share code, notes, and snippets.

View oblique63's full-sized avatar

Enrique Gavidia oblique63

  • San Francisco, CA
View GitHub Profile
@oblique63
oblique63 / gist:1446920
Created December 8, 2011 12:54
my .profile
# Shorten lengthy paths
PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 30 ]; then CurDir=${DIR:0:12}...${DIR:${#DIR}-15}; else CurDir=$DIR; fi'
# Git status in prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ [\1$(parse_git_dirty)]/"
}
@oblique63
oblique63 / template.zen
Created December 8, 2011 09:21
Template language idea
/*
* 'Zenplate': a language/template-engine agnostic markup DSL
*/
// extending a zenplate
extend -> 'base.zen'
// support for extending templates from other template engines
extend -> jinja 'base.j2'
@oblique63
oblique63 / doto.coffee
Created July 18, 2011 05:36
Clojure's "doto" in CoffeeScript
doto = (object, operations...) ->
process = (operation) ->
for method, arguments of operation
# Additional fancy nonsense to keep things DRY
if method is 'repeatedly'
[method, arguments] = [name,args] for name, args of arguments
operation = {}
for argument in arguments
operation["#{method}"] = argument
process operation
@oblique63
oblique63 / .conkerorrc
Created April 16, 2011 01:47
Configuration file for the Conkeror web browser.
load_paths.unshift("chrome://conkeror-contrib/content/");
mode_line_mode(false);
// Disables security checking for FF extensions
session_pref("xpinstall.whitelist.required", false);
require("clicks-in-new-buffer.js");
clicks_in_new_buffer_target = OPEN_NEW_BUFFER_BACKGROUND;
clicks_in_new_buffer_button = 1;
@oblique63
oblique63 / .emacs
Created November 13, 2010 04:46
.emacs customizations
;;;; Custom color theme
(defun color-theme-tangotango ()
"A color theme based on Tango Palette colors."
;; Color codes :
;; - blue : "dodger blue"
;; - yellow : "#edd400"
;; - green : "#6ac214"
;; - orange/red : "tomato"
(interactive)
(color-theme-install
@oblique63
oblique63 / install_clojure.sh
Created November 6, 2010 22:25
Automates installation of Clojure [most current version] on a fresh Ubuntu system
# Be sure to place this script in the directory where you wish to install Clojure
sudo apt-get install sun-java6-jdk ant git
echo 'JAVA_HOME="/usr/lib/jvm/java-6-sun/" && export JAVA_HOME' >> ~/.profile
source ~/.profile
git clone https://github.com/clojure/clojure.git && cd clojure && ant
echo "java -cp `pwd`/clojure.jar clojure.main $@" > clojure
chmod +x clojure && sudo ln -s `pwd`/clojure /usr/bin/clojure
@oblique63
oblique63 / src_expander.py
Created November 5, 2010 12:42
Expands minified CSS/Javascript files. No support for Strings or Regex syntax.
from os.path import abspath, isfile
import sys
def expand(filename):
"Expands minified Javascript/CSS files."
filename = abspath(filename)
is_js = filename.endswith(".js")
is_css = filename.endswith(".css")
assert isfile(filename) and (is_js or is_css), "Invalid File"
@oblique63
oblique63 / addpath.sh
Created November 3, 2010 13:21
Adds new paths to the PATH environment variable
echo "PATH=\"$1:\$PATH\" && export PATH" >> ~/.profile
source ~/.profile
@oblique63
oblique63 / .bash_aliases
Created May 30, 2010 11:40
Bash Aliases for Ubuntu
#----{ Aliases for Ubuntu: }--------------------------------------------------
# Admin
alias update="sudo aptitude update ; sudo aptitude -ZWry safe-upgrade && sudo aptitude -ZWry --purge-unused clean"
alias sources="sudo nano /etc/apt/sources.list"
alias install="sudo aptitude -ZWry install"
alias uninstall="sudo aptitude -ZWry remove"
alias pkgsearch="aptitude search"
alias installed="dpkg --get-selections | grep"
alias add-repo="sudo add-apt-repository"
alias app="apropos"