Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@madrobby
madrobby / gist:2997187
Created June 26, 2012 17:13
The ultimate media query to rule them all ("all" being high DPI/"Retina" screens)
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
/* "retina" styles */
}
@blister
blister / gist:740829
Created December 14, 2010 18:19
Bash script to add a delay to the localhost interface on Linux machines
#!/bin/bash
# Copyright 2010 Eric Ryan Harrison <me@ericharrison.info>
# Inspired by:
# http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
if [ -n "$1" ]
then
if [ "$1" = "off" ]
then
tc qdisc del dev lo root
@nowhereman
nowhereman / awesome_nested_set_helper.rb
Created August 26, 2010 12:32
Awesome Nested Set Helper who returns options for select with only one DB query.
# Copy this file in RAILS_ROOT/config/initializers/awesome_nested_set_helper.rb
module CollectiveIdea::Acts::NestedSet::Helper
# Like #nested_set_options helper but with only one DB query
#
# Returns options for select.
# You can exclude some items from the tree.
# You can pass a block receiving an item and returning the string displayed in the select.
#
# == Params
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);