Skip to content

Instantly share code, notes, and snippets.

View danielres's full-sized avatar

Daniel Reszka danielres

View GitHub Profile
@danielres
danielres / SCSS mixin: two-columns.scss
Created November 7, 2010 16:26
COMPASS/SCSS mixin for 2 column CSS layout
@mixin two-columns($prop1, $prop2, $col1 = '.main', $col2 = '.sub'){
$totalwidth : $prop1 + $prop2;
#{$col1} {
@include column(ceil($blueprint-grid-columns * $prop1 / $totalwidth ));
}
#{$col2} {
@include column(floor( $blueprint-grid-columns * (1 - $prop1/($prop1 + $prop2))), true);
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Pixarea XHTML Transitional boilerplate</title>
<meta name="title" content="" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
@danielres
danielres / .htaccess
Created November 7, 2010 22:30
generate a functionnal rails application on alwaysdata
# General Apache options
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
@danielres
danielres / controller.rb
Created November 10, 2010 23:41
how to have checkboxes in the view for a many-to-many relationship
# in controller:
def update
# (.....)
@categories = Category.all
checked_categories = []
checked_params = params[:category_list] || []
# source: http://tech.patientslikeme.com/2010/05/12/manage-your-css3-tricks-with-sass-mixins/
# complete mixin:
=box_gradient(!top,!bottom)
background-image = “-moz-linear-gradient(top, #{!top}, #{!bottom})”
background-image = “-webkit-gradient(linear,left top,left bottom,color-stop(0, #{!top}),color-stop(1, #{!bottom}))”
-ms-filter = “progid:DXImageTransform.Microsoft.gradient(startColorStr=’#{!top}’, EndColorStr=’#{!bottom}’)”
# isolated:
=box_gradient_ie67(!top,!bottom)
@danielres
danielres / CSS3 notes.css
Created November 26, 2010 12:30
quick notes for CSS3 cross-browser declarations
div {
-moz-box-shadow: black 1px 1px 15px 0;
-webkit-box-shadow: black 1px 1px 15px 0;
-o-box-shadow: black 1px 1px 15px 0;
box-shadow: black 1px 1px 15px 0;
}
div {
-moz-border-radius: 10px;
<p>
<a href="/signup/" class="multiline_button blue" style="width: 245px">
<big>Start Free Trial</big>
<small>30-days free! Signup in 60 seconds</small>
</a>
</p>
<p>
<a href="/signup/" class="multiline_button brown" style="width: 245px">
<big>Start Free Trial</big>
@danielres
danielres / simple_blog_schema.rb
Created November 29, 2010 22:34
Just a simple DB schema for a rails simple blog
ActiveRecord::Schema.define(:version => 20101119175732) do
create_table "categories", :force => true do |t|
t.string "name"
t.string "shortname"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "categories_posts", :id => false, :force => true do |t|
@danielres
danielres / erb2haml.rb
Created December 22, 2010 23:01
A little script to convert all your .erb views to .haml using html2haml, which is included with Haml installation. Just drop this in your rails root folder and run it. source: http://snippets.dzone.com/posts/show/5449
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
end
end
@danielres
danielres / .htaccess
Created December 29, 2010 10:45
generate functional rails app on hostingrails
# General Apache options
# AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*