Skip to content

Instantly share code, notes, and snippets.

View dcoder2099's full-sized avatar

Daniel Hedrick dcoder2099

View GitHub Profile
@dcoder2099
dcoder2099 / gist:2707087
Created May 16, 2012 03:25
strategy for bootstrap customization
application.css pulls in three additional stylesheets that contains the bulk of
the bootstrap customization (in this load order):
customized/overrides.css.less
- @import "twitter/bootstrap/variables";
- @import "twitter/bootstrap/mixins";
- perform class overrides on things like nav-tabs and the like
customized/components.css.less
- used to provide stylistic effects that are mostly typographic
customized/layout.css.less
- used to provide layout effects that are mostly positional
@dcoder2099
dcoder2099 / vimrc.after
Created May 15, 2012 20:10
vimrc before and after, for Janus
" .vimrc.after
" Turn off that damn-fool blinking...
set guicursor+=a:blinkon0
" Hide macvim toolbar
if has("gui_running")
set guioptions=egmrt
endif
" colorscheme
colorscheme peachpuff
@dcoder2099
dcoder2099 / gist:1287689
Created October 14, 2011 17:07
using i18n to present human-friendly AR model names
For the purpose of this query, assume that there is an ActiveRecord model with an attribute (db column) with the name 'obscure_field'.
In the AR class is the following validation call:
validates_presence_of :obscure_field, :message => 'is necessary'
However, in the view, this field is labeled as "Meaningful Field":
(formtastic syntax)
<%= f.input :obscure_field, :label => 'Report type', :required => true %>
@dcoder2099
dcoder2099 / base64.js
Created August 7, 2011 16:30
base64.js encoder
/*
* base64.js - Base64 encoding and decoding functions
*
* See: http://developer.mozilla.org/en/docs/DOM:window.btoa
* http://developer.mozilla.org/en/docs/DOM:window.atob
*
* Copyright (c) 2007, David Lindquist <david.lindquist@gmail.com>
* Released under the MIT license
*/
@dcoder2099
dcoder2099 / ackrc
Last active January 16, 2024 17:06
bash_profile
--ignore-case
--color
--group
--type-set=markdown:ext:markdown,md,mdown
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
# walk down a file until you get to the data section, then suck it in
# (presumes data section is preceded by a row of separator-dashes. :)
while(<>) {
chomp;
until (/-------------------- ------------------/) { ; } # do nothing until we get these
while(<>) {
chomp;
($object_id, $description) = ($1, $2) if m/(\d+)\s+(\w+)/;
print "$object_id, $description\n";
}
// This is a TCP server which listens at 127.0.0.1:8203
// All it does is log everything sent across the wire to the console.
// Send ^D as first char of buffer to shut down.
var net = require('net');
var CONTROL_D = String.fromCharCode(4);
net.createServer(function (socket) {
socket.setEncoding("utf8");
socket.write("Logging Test Server\r\n");
socket.on("data", function (data) {
console.log(data);
@dcoder2099
dcoder2099 / border-width-demo.html
Created May 9, 2010 16:40
How is DOM border-width calculated? A visual demonstration.
<!DOCTYPE html>
<html>
<head>
<title>Width Test</title>
<meta charset="utf-8">
<style>
body {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGNJREFUeNrs1DENwDAMRcG0iALfMAwjLFIT8NpG1f3Vyw3WG7vfWuuTa0Tc48hhYWFhtbuqbCe6VN7LY2FhqbzKe3ksLCyVV3ksLCyVV3mVx8LC+mXlq13dbc6Zme9fa48AAwDFKPsBdzTEzgAAAABJRU5ErkJggg==');
}
h1 {