Skip to content

Instantly share code, notes, and snippets.

@lotsofcode
lotsofcode / slug.js
Created October 4, 2012 15:32 — forked from bentruyman/slug.js
JavaScript Slug Generator
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};
@lotsofcode
lotsofcode / new_bashrc.sh
Created August 11, 2012 09:17 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
@lotsofcode
lotsofcode / readme2ghpage.rb
Created June 22, 2012 15:37 — forked from hopsoft/readme2ghpage.rb
Convert your README.md on master to index.md on gh-pages
#!/usr/bin/env ruby
# checkout the readme from the master branch
`git checkout gh-pages; git checkout master README.md`
path = `pwd`.gsub(/\n/, "")
readme_path = File.join(path, "README.md")
index_path = File.join(path, "index.md")
# write the index readme file
@lotsofcode
lotsofcode / Custom.css
Created May 25, 2012 10:00 — forked from bentruyman/Custom.css
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@lotsofcode
lotsofcode / hack.sh
Created March 31, 2012 11:28 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@lotsofcode
lotsofcode / .bashrc
Created December 13, 2011 20:10 — forked from endtwist/.bashrc
Bash config
PS1="\[\e[0:32m\]\w \[\e[0;39m\]\$ "
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
PS1="\[\e[0:32m\]\w"'$(__git_ps1 " \[\e[1;30m\](%s)")'"\[\e[0;39m\]\$ "
fi
export CLICOLOR=1
export ll='ls -al'
#!/bin/bash
hash make 2>&- || { echo >&2 "I require make but it's not installed. Aborting."; exit 1; }
hash autoreconf 2>&- || { echo >&2 "I require aureconf but it's not installed. Aborting."; exit 1; }
hash unzip 2>&- || { echo >&2 "I require unzip but it's not installed. Aborting."; exit 1; }
hash svn 2>&- || { echo >&2 "I require svn but it's not installed. Aborting."; exit 1; }
function errorcheck(){
if [ "$?" -gt 0 ]; then