Skip to content

Instantly share code, notes, and snippets.

@dvessel
dvessel / compass-retina-sprites.scss
Created November 21, 2012 14:37 — forked from thulstrup/compass-retina-sprites.scss
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style>
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; }
.wrapper { width: 6000px; }
.frame { float: left; }
h2 { margin: 0 0 5px 0; }
@dvessel
dvessel / r-em-sizing.scss
Last active October 30, 2018 09:59
font-size in rem and a tool for absolute to em conversion. http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/
// Inspired by this post from CSS-Tricks.
// http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/
//
// Plays nice with compass/typography/vertical_rhythm
// http://compass-style.org/reference/compass/typography/vertical_rhythm/
//
// Calculates font size in `rem` (root em).
//
// Relative values depends on $base-font-size. Pixle value for font-size depends
// on $legacy-support-for-ie6 or $legacy-support-for-ie7 or $legacy-support-for-ie8
require 'rake'
require 'css_splitter'
desc 'split css files'
namespace :css do
task :split do
infile = ENV['infile'] || raise("missing infile")
outdir = ENV['outdir'] || File.dirname(infile)
max_selectors = ENV['max_selectors'] || 4095
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@dvessel
dvessel / selective-ie.scss
Last active December 12, 2015 02:59
ie mixins
/**
* To minimize bloat, compile IE styles into their own style sheets.
*
* http://nicolasgallagher.com/mobile-first-css-sass-and-ie/
*
* Expanded on these selector hack mixins from Chris Eppstein.
*
* https://gist.github.com/1215856#file_6_media_queries.scss
*
* Create your own... Or not. Don't go overboard. These are most likely good

Install XHProf

Pear

pear upgrade PEAR
pecl install xhprof-0.9.2

From source

@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@dvessel
dvessel / pr.md
Created March 26, 2013 00:17 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@dvessel
dvessel / gist:5312604
Created April 4, 2013 18:01
Get all node types and information on their fields.
<?php
foreach (array_keys(field_info_instances('node')) as $node_type) {
$fields_info = field_info_instances('node', $node_type);
print $node_type . '</br>';
foreach ($fields_info as $field_name => $value) {
$field_info = field_info_field($field_name);
$field_name = $field_info['field_name'];
$type = $field_info['type'];
$module = $field_info['module'];