Skip to content

Instantly share code, notes, and snippets.

View nkpgardose's full-sized avatar
🖥️
Dev life

Neil Gardose nkpgardose

🖥️
Dev life
View GitHub Profile
@nkpgardose
nkpgardose / clamp.css
Last active August 29, 2015 14:24
Clamping is the king. Ellipsis gaming
.clamp {
overflow: hidden;
}
.clamp.is-active {
position: relative;
height: 7em;
}
.clamp.is-active:after {
content: "";
text-align: right;
@nkpgardose
nkpgardose / terminal-commands.md
Last active February 23, 2016 02:14
Useful commands on plain terminal

Useful command using ol' plain terminal

Position the cursor in your terminal

alt + [cursor]

pbcopy & pbpaste

$ echo 'Hello World' | pbcopy

CSS Code Guidelines

We all know when project/s gets really big, CSS problems will pop out and will take a lot of your time troubleshooting rather than finishing your tasks. Here are some problems:

  • Rule clash, since the project is big. There's a possibility of rule clash.
  • Cascading too much #override-sale .checkout-dog .full-width .button-primary is real. Specificity makes the style hard to refactor and introduce unnecessary performance overhead for applying styles
  • Class with JS on it are hardest to deal with.

This is a simple guidelines that I'm implementing when doing CSS. Adapted from the work being done in the SUIT CSS framework and @fat's guideline. Which is to say, it relies on structured class names and meaningful hyphens (i.e., not using hyphens merely to separate words). This is to help developers to quickly understand the code even at glance.

source 'https://rubygems.org'
gem 'bundler', '>= 1.8.4'
gem 'hpricot'
gem 'premailer-rails'
# Add devise (Dependent on bycrypt for has_secure_password)
gem 'devise'
# Lest worry on browser support and just write styles
gem "autoprefixer-rails"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
@nkpgardose
nkpgardose / Devise
Last active September 27, 2015 02:40
Simple answer/s to every question you search
Simple answer/s to every question you search
@nkpgardose
nkpgardose / app.scss
Created December 7, 2015 13:28
Add f6 thru rails-assets and add this to a scss file
// Third-party libraries
@import "foundation-sites/vendor/normalize";
// Sass utilities
@import "foundation-sites/util/util";
// Global variables and styles -- Add a global file `app/assets/stylesheets`
@import "global";
// Components
@import "foundation-sites/grid/grid";
@nkpgardose
nkpgardose / app.scss
Created December 7, 2015 13:28
Add f6 thru rails-assets and add this to a scss file
// Third-party libraries
@import "foundation-sites/vendor/normalize";
// Sass utilities
@import "foundation-sites/util/util";
// Global variables and styles -- Add a global file `app/assets/stylesheets`
@import "global";
// Components
@import "foundation-sites/grid/grid";
$columns-phone: 4;
$columns-tablet: 8;
$columns-desktop: 12;
$columns-default: 4;
$gutter-phone: 16px;
$gutter-tablet: 16px;
$gutter-desktop: 16px;
def user_params
other_phones = params.require(:user).fetch(:other_phones, nil).try(:permit!)
params[:user].delete(:other_phones)
params.require(:user).
permit(:email, :password, :password_confirmation, ...).
merge(other_phones: other_phones)
end
.textfield {
@include font-sans-N3;
box-sizing: border-box;
margin-bottom: $form-space;
min-height: 44px;
padding: 11px 10px 11px 13px;
font-size: $base-font-size;
background-color: $color-white;
border: 1px solid $color-gray;
border-radius: $base-border-radius;