Skip to content

Instantly share code, notes, and snippets.

Chris Eppstein chriseppstein

Block or report user

Report or block chriseppstein

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chriseppstein
chriseppstein / _minified_filenaming.md
Last active Jun 17, 2019
compiling a minified version of css. This configures your compass project to emit files in minified form when compiling for production.
View _minified_filenaming.md
$ compass compile --environment production && compass compile

Afterwards you will have both the minified and non-minified versions in your output folder. Note that compass clean will not clean up your minified files.

View sass_and_less_compared.markdown

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@chriseppstein
chriseppstein / 0_selector_hacks.scss
Created Sep 14, 2011
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
View 0_selector_hacks.scss
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@chriseppstein
chriseppstein / readme.md
Created Aug 31, 2011 — forked from mislav/Gemfile
How to integrate Compass with Rails 3.1 asset pipeline
View readme.md

This gist is no longer valid. Please see Compass-Rails for instructions on how to install.

View grandparent_mixin.scss
@function up-to($list, $index) {
$l: ();
@each $e in $list {
@if length($l) < $index {
$l: append($l, $e, list-separator($list));
}
}
@return $l;
}
@chriseppstein
chriseppstein / defining_placeholders_once.scss
Created Apr 17, 2012
If you have a module with placeholder selectors, this pattern will help you avoid outputting them twice if imported twice.
View defining_placeholders_once.scss
$module-placeholders-defined: false !default;
@mixin module-placeholders {
@if not $module-placeholders-defined {
$module-placeholders-defined: true;
%module-object { color: red; }
%module-object:hover { color: blue; }
}
}
@include module-placeholders;
View README.markdown

This is a tutorial for beginning users of the macintosh terminal. Please feel free to fork this and edit/augment it. Good changes will get merged in.

@chriseppstein
chriseppstein / _mongoid_n00b_notes.markdown
Created Jan 21, 2011
some notes from a n00b learning Mongoid
View _mongoid_n00b_notes.markdown

Custom Keys

  1. I typed identity :my_attr => String instead of identity :type => String. It failed later with a strange nil error. Turns out I wanted to use key :my_attr method instead. Would have appreciated an error saying :type was missing from the hash.
  2. If you change a value related to the key, it fails silently. It even says it saved succesfully when it didn't. I would have found any of the the following behaviors reasonable as long as they were documented:
    1. Don't let me change a value used in a key at the point where I set it.
    2. Let me change a value related to a key, but don't update the _id itself
    3. Remove the old doc and make a new one and maybe assist me with renaming any references.
  3. I didn't expect parameterize_keys to default to true (or that it even exists) and it took me reading thru the code to understand what was going on. I had a field that was safe in a url but it turned my dashes into "-dash-" for no apparant reason. Once I understood it, I found
View 0_namespacing.scss
mymodule {
@at-root {
.#{&}-header { ... }
.#{&}-footer { ... }
.#{&}-body {
a { ... }
span { ... }
p { ... }
}
}
View tagged_string_example.ts
declare const EmailTag: unique symbol;
type Email = string & typeof EmailTag;
function isEmail(email: string): email is Email {
return /@/.test(email);
}
function createEmail(email: string): Email;
function createEmail(username: string, domain?: string): Email {
if (domain) {
You can’t perform that action at this time.