Skip to content

Instantly share code, notes, and snippets.

sudo brew update
sudo brew install jruby # latest version is 1.6 (03/24/2010)
sudo gems update --system
sudo gems uninstall rawr # rawr should install via jruby
sudo jruby -S gems install rawr
# at root directory of CompassApp
sudo jruby -S rake rawr:bundle:app
# build location is package/osx/compass.app
@maylogger
maylogger / grid.scss
Created March 16, 2011 17:45
示範如何用 scss 的 mixin 寫出一個可任意輸入數值的 grid system
@mixin grid($columns,$col-width,$gutter) {
width: ($col-width * $columns) + ($gutter * $columns);
.column {
margin: 0 $gutter $gutter 0;
float: left;
}
@for $i from 1 through $columns {
.col#{$i} {
width: ($col-width * $i) + ($gutter * ($i - 1));
}
@maylogger
maylogger / self-clear.scss
Created March 16, 2011 17:20
用 scss 寫出一個 ie 也沒問題的 self-clear
@mixin self-clear {
clear: both;
&:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
*:first-child+html & { min-height: 1px; } // hack ie7
$(this).removeClass(function(index, cls) {
var classes = cls.split(' ');
var result = new Array();
$.each(classes, function(index, value) {
if(value.substring(0, 3) == 'col') {
result.push(value);
saveCol = saveCol + value;
}
});
return result.join(' ');
/* Reset CSS v1.0 | 20080212 */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } ins { text-decoration: none; } del { text-decoration: line-through; } table { border-collapse: collapse; border-spacing: 0; }
/* self clear */
.group { clear: both; }
.group:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
/* hack ie7 */
*:first-child+html .group { min-height: 1px; background: red; }
/* hack ie6 */
* html .group { height: 1%; background: green; }
@blue: #276373;
@dark_blue: #1c4c52;
@dark_gray: #636363;
@gray: #cdcece;
@red: #911400;
body {
background: @gray;
font-size: 12px;
font-family: Helvetica, Verdana, 'LiHei Pro', 新細明體, sans-serif;