Skip to content

Instantly share code, notes, and snippets.

@greypants
greypants / viget-unfuddle.css
Created October 26, 2011 17:45
CSS: Unfuddle Viget Theme
#main {
width: 70%;
padding: 2%;
}
th.field_heading_version a {
color: #DD4B39;
}
li.tab_time_tracking a {
@greypants
greypants / grid.scss
Created February 25, 2012 21:24
SCSS: Basic SCSS Grid System
/* @group SCSS Grid */
$column-width: 45px;
$gutter-width: 16px;
@mixin col-width($span){
width: ($column-width + $gutter-width) * $span - $gutter-width;
}
@mixin col-offset($span){
@greypants
greypants / README.markdown
Created April 9, 2012 15:15
Rails: Versatile nav_link helper for adding 'selected' class to navigation elements

The nav_link helper

Drop nav_link_helper.rb into app/helpers in your Rails app and enjoy.

The nav_link helper works just like the standard Rails link_to helper, but adds a 'selected' class to your link (or its wrapper) if certain criteria are met. By default, if the link's destination url is the same url as the url of the current page, a default class of 'selected' is added to the link.

###Basic Example If the url of the current page matches the url of the link (http://example.com/page),

<%= nav_link 'My_Page', 'http://example.com/page' %>
@greypants
greypants / swfobjectEmbed.html
Created May 11, 2012 17:33
JS: swfobject.embedSWF
<script type="text/javascript">
var flashvars = {},
params = {},
attributes = {};
swfobject.embedSWF("untitled.swf", "containerId", "800", "600", "9.0.0", false, flashvars, params, attributes);
</script>
<div id="containerId">
@greypants
greypants / gist:2702191
Created May 15, 2012 14:29
HTML: Layout
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="no-js ie ie6 lte8 lte7 lte6"><![endif]-->
<!--[if IE 7 ]><html class="no-js ie ie7 lte8 lte7"><![endif]-->
<!--[if IE 8 ]><html class="no-js ie ie8 lte8"><![endif]-->
<!--[if !IE]><!--><html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title> </title>
@greypants
greypants / gist:2771294
Created May 22, 2012 20:04
CSS: Generated Triangle
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #6e9116;
content: "";
display: block;
position: absolute;
@greypants
greypants / externalInterface.as
Created May 24, 2012 20:54
AS3: External Interface Example
import flash.external.ExternalInterface;
// Calling a JavaScript function from AS3 (with optional parameters)
if (ExternalInterface.available) ExternalInterface.call("javascriptFunction", param1, param2);
// Implementing a JavaScript callback in AS3 (flashFunction is called when JavaScript calls javascriptFunction)
if (ExternalInterface.available) ExternalInterface.addCallback("javascriptFunction", flashFunction);
@greypants
greypants / ie_conditional_html_tag.html
Created May 24, 2012 21:49
HTML: IE Conditional <html> tag
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="no-js ie ie6 lte6 lte7 lte8 lte9"><![endif]-->
<!--[if IE 7 ]><html class="no-js ie ie7 lte7 lte8 lte9"> <![endif]-->
<!--[if IE 8 ]><html class="no-js ie ie8 lte8 lte9"><![endif]-->
<!--[if IE 9 ]><html class="no-js ie ie9 lte9"><![endif]-->
<!--[if gt IE 9]><!--><html class="no-js"><!--<![endif]-->
@greypants
greypants / uri.js
Created May 25, 2012 17:43 — forked from jlong/uri.js
JS: URI and Query String Parsing
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
# Creates a bzip2 file (smaller than tarball)
tar -cjf backup.tar.bz2 directory
# which can be decompressed using...
tar -xjf backup.tar.bz2
# remove directory
rm -r -f YourDirectory