Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@beakr
beakr / disable_intro_message.vim
Created March 29, 2012 16:05
How to disable Vim intro message.
set shortmess=I " Read :help shortmess for everything else.
@beakr
beakr / search.css
Created March 30, 2012 02:04
Nice search bar (hand made).
.search {
/* Roundness */
border: 1px solid #BABABA;
border-radius: 20px;
height: 35px;
width: 300px;
padding: 8px;
background: white;
@beakr
beakr / comment_box.css
Created March 30, 2012 12:54
Expanding nice comment box.
.comment_box {
/* Cosmetic */
margin-left: 30px;
margin-top: 50px;
border-radius: 7px;
border-color: #BABABA;
box-shadow: 1px 5px 2px #EDEDED;
height: 130px;
width: 300px; /* Was 470px */
@beakr
beakr / fading_links.css
Created March 31, 2012 11:57
Fading links, only works in CSS3.
@beakr
beakr / gist:2321854
Created April 6, 2012 18:23
Telling if the entire string consists of an item (whitespace in this case)
var re = /^\s+$/;
/*
* ^ - start of string
* \s - anything whitespace
* + - 1 or more
* $ - the end of the string
*/
if (" ".match(re)) {
@beakr
beakr / gist:2336852
Created April 8, 2012 11:58
Full date regexp.
describe ".full_date" do
it 'returns a full date' do
d.full_date.should =~ /^[A-Z]\w+ \d{1,2} \d{4}$/
end
end
# In zsh you can use <esc>+h to automatically open a help file for the given command
$ git # + <esc>+h
# Becomes
$ run-help git
@beakr
beakr / app.rb
Created April 10, 2012 17:42
Sinatra app with Rate
require 'sinatra'
require 'rate'
get '/random-date' do
d = Rate::Date.new
d.full_date.strftime("%b %d %Y")
end
@beakr
beakr / gist:2366843
Created April 12, 2012 12:07
Modify Ruby actions based on version.
if RUBY_VERSION < 1.9
# Do something based on the version...
end
@beakr
beakr / gist:2367061
Created April 12, 2012 13:02
FileUtils Dryrun
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils::DryRun # Will only print what your command does. Useful if you're using
# something like `rm -rf`.
mkdir('test')
cd('test')