Skip to content

Instantly share code, notes, and snippets.

// This generates a duplicate selector
h1,
.h1 {
font-size: 24px; }
.fake-module {
.fake-header-1 {
@extend .h1; } }
// compiles to =>
h1,
@rickharris
rickharris / nginx-repo.txt
Created January 10, 2012 05:29
Nginx Repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
@rickharris
rickharris / mongodb-repo.txt
Created January 10, 2012 05:08
MongoDB repo
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
@rickharris
rickharris / _shared.scss
Created December 18, 2011 17:02
Media queries with IE support using Sass 3.2 features
// Using this structure, this file should be your canonical stylesheet where
// everything would be imported into, so that you can just `@import "shared";`
// in both your normal and IE stylesheets, only having to add libraries and
// such in one place.
// These styles are just a contrived example.
body {
font-size: 18px;
@include respond-to(desktops) {
color: blue;
@rickharris
rickharris / dry-with-sass-lists
Created December 12, 2011 17:53 — forked from ry5n/dry-with-sass-lists
Using Sass lists for DRY-er code
// Shared colors for buttons and alerts
//
// Use Sass lists to avoid writing out repeating patterns of Sass code.
//
// For example, the following avoids having to write out a selector and
// set of style rules for each alert type, when only class and
// variable names are different.
//
// Follows (and many thanks to) Nathan Weizenbaum (@nex3)’s comment at:
// http://groups.google.com/group/sass-lang/msg/987926ad9fe5ad43?
<?php
class Helper_View {
public static function render($template_suggestions, $data)
{
$last_exception = null;
foreach ($template_suggestions as $template)
{
try
{
return View::factory($template, $data);
<?php
class Helper_View {
public static function render($template_suggestions, $data)
{
$last_exception = null;
foreach ($template_suggestions as $template)
{
try
{
return View::factory($template, $data);
@rickharris
rickharris / _grid.scss
Created November 12, 2011 20:40
Using Susy (http://susy.oddbird.net/) with @extend rather than @include
// Imports -------------------------------------------------------------------
@import "susy";
// Configuration -------------------------------------------------------------
$total-cols : 12;
$col-width : 4em;
$gutter-width : 1em;
$side-gutter-width : $gutter-width;
<?php
abstract class Controller_Parts extends Controller_Template {
/**
* @var Array Ordered list of steps in the form <step name> => <function to execute>
*/
protected $steps = array(
'make' => 'vcdb',
'year' => 'vcdb',
@rickharris
rickharris / controller.php
Created October 21, 2011 20:19
FuelPHP method-specific, controller-based SSL solution
<?php
class Controller extends Fuel\Core\Controller {
public $secure = array();
public function before($data = null)
{
$should_be_secure = in_array($this->request->action, $this->secure);