Skip to content

Instantly share code, notes, and snippets.

@dvessel
dvessel / base-debug.css
Last active December 20, 2015 01:19
Ensure component modifiers have a set base. @extend in Sass can get out of hand. Manually setting both base and modifiers can trim down the compiled styles.
// Find modifer without base.
// .[base--]modifier - yes
// .[base-s]ubelement - no
// .foo-[base--]modifier - no
// .bar[base--]modifier - uhh.. Just name your classes correctly.
[class*="base--"]:not([class*="-base--"]) {
outline: 2px solid red;
}
// Base exists, cancel.
[class*="base--"]:not([class*="-base--"]).base {
@dvessel
dvessel / template.php
Last active March 11, 2021 21:43
Drupal theme registry alterations to allow theme functions, preprocess/process function to be organized like templates (.tpl.php).
<?php
/**
* Theme templates, functions and preprocess/process functions
*
* Theme templates `*.tpl.php` files are stored in the `theme` directory along
* with `*.func.php` and `*.vars.php` files. The latter two are enabled by the
* processing done below. The three types of files can be grouped into
* sub-directories. It is recommended that they are grouped by the modules
* they originate from. Theme specific hooks should be grouped into a folder
@dvessel
dvessel / .bash_profile
Last active December 18, 2015 05:48
A few of my dot files.
# Styles @see man terminfo
__blu=`tput setaf 25` # blue
__gra=`tput setaf 245` # gray
__ora=`tput setaf 208` # orange
__end=`tput setaf 0` # end colors
__bol=`tput bold` # bold
__res=`tput sgr0` # reset
# /usr/local/* defined so it comes before /usr/bin and /bin. Required for
# Homebrew. Default PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
@dvessel
dvessel / gist:5406410
Created April 17, 2013 18:01
AppleScript I use with LaunchBar to upload screenshots to dropbox. tmp folder automatically cleans itself out every month through Hazel.
--Two changes to be made before you use this script
--1. Find this line in the script below and change it to the path to your Dropbox Public folder.
--Change pubfolder to the path of your dropbox public folder (ex. /Users/John/Dropbox/Public/)
--2. Observe one of your Dropbox URLs and you will notice that there are some numbers in those URLs. That is your Dropbox id.
--Find this line in the script below and change it to your Dropbox id instead of 123456
--set dropboxID to 123456
-------------------------------------------------------------------
--How to use?
--Bring this script in LaunchBar, press space and type the name that you would like to give to that screenshot and press return
--e.g. myname
@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'];
@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:

@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}

Install XHProf

Pear

pear upgrade PEAR
pecl install xhprof-0.9.2

From source

@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
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}