Skip to content

Instantly share code, notes, and snippets.

@procload
procload / Ample Style Guide: Breakpoint Hierarchy.scss
Last active December 16, 2015 04:08
Correct breakpoint hierarchy
.about-page {
.content-header {
background: $white;
padding: calc-em(30px);
width: 33%;
@include respond-to('30em') {
padding: calc-em(15px);
width: 50%;
} //30-em breakpoint
} //content-header
@procload
procload / Ample Style Guide: Directory Structure.txt
Created April 12, 2013 19:44
Proper SCSS directory structure.
stylesheets
│ ├── screen.scss
│ └── print.scss
├── pages
│ ├── about.scss
│ ├── blog.scss
│ ├── contact.scss
│ ├── home.scss
│ └── listings.scss
├── partials
.about {
.content-block {
padding: calc-em(20px) 0;
} //content-block
} //about
module Public::BidsHelper
def bid_status_for(item, user = nil)
user ||= current_user
if item.high_bid_user_id.eql?(user.id)
<<<<<<< HEAD
html = %Q{<i class="icon-trophy winning"></i>}
elsif item.bids.where(user_id: user.id).any?
html = %q{<i class="icon-ban-circle outbid"></i>}
=======
@procload
procload / handy-mixins.scss
Last active December 17, 2015 09:19
Handy dandy SASS mixins. Some I wrote myself, others I've modified and the rest I've taken. Enjoy.
// MATH & LAYOUT
// --------------------------------------------------
@function calc-em($target-px, $context: $base-font-size) {
@return ($target-px / $context) * 1em;
}
/* One-true layout hack for equal height columns */
@mixin equalize-column {
margin-bottom: -99999px;
padding-bottom: 99999px;
def count_letters(given_string)
given_arr = given_string.split('')
puts "String length: #{given_arr.length}"
hsh = {}
given_arr.each do |character|
hsh[character] = hsh.fetch(character,0) + 1
end
hsh.each_pair do |key, val|
@procload
procload / eqs_workaround.scss
Created July 2, 2013 19:55
Working around element queries.
@mixin respond-to($viewport-width, $ie-version: 'lt-ie9') {
@media only screen and (min-width: $viewport-width) {
@content;
}
@if $ie-version == 'lt-ie9' {
html.lt-ie9 & { // Using Paul Irish's conditional comments
@content;
}
}
@mixin respond-to($viewport-width, $ie-version: 'lt-ie9') {
@media only screen and (min-width: $viewport-width) {
@content;
}
@if $ie-version == 'lt-ie9' {
html.lt-ie9 & { // Using Paul Irish's conditional comments
@content;
}
}
@else if $ie-version == 'lt-ie8' {
@procload
procload / vcard.htm.erb
Created July 18, 2013 15:41
An example vcard. Find the rest of the attributes here: http://microformats.org/wiki/h-card#Example
<div class="h-card">
<div class="photo">
<%= image_tag 'http://placehold.it/150x190', class: 'u-photo' %>
<%= link_to '<i class="icon-search"></i> Hi-res', '#', class: 'hi-res' %>
</div> <!-- /photo -->
<div class="details">
<a class="p-name" href="http://example.org">Marc E. Rothenberg, MD, PHD </a>
<p class="p-job-title">Director, Division of Allergy and Immunology</p>
<p class="p-job-title">Director, Cincinnati Center for Eosinophilic Disorders</p>
<p class="p-job-title">Program Director, CHRCDA (K12)</p>
.product-listing {
@extend %group;
.product {
@include respond-to(36.25em) {
//580px
@include span-columns(8);
@include nth-omega(2n);
}
@include respond-to(47.5em) {