Skip to content

Instantly share code, notes, and snippets.

View being-frank's full-sized avatar
👌
¯\_(ツ)_/¯

Frank being-frank

👌
¯\_(ツ)_/¯
View GitHub Profile
@being-frank
being-frank / database.yml
Created November 21, 2012 20:50
DRY database.yml
common: &common
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
username: user
password:
development:
<<: *common
@being-frank
being-frank / gist:4414351
Last active December 10, 2015 09:29
A re-usable SCSS mixin that replaces the original -9999px image replacement hack.
@mixin hide-text {
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
}
body h1:first-child {
@include hide-text;
background: url('https://www.google.com/images/srpr/logo3w.png') no-repeat 50% top;
height: 95px;
@being-frank
being-frank / product.rb
Created January 29, 2013 11:29
Generate an unique code and check if it already exists before creating a new record. If it does exist, generate a new code and check again.
class Product < ActiveRecord::Base
before_create :generate_unique_code
private
def generate_unique_code
begin
self.code = ("%05d" % Random.new.rand(99999))
end while !Product.find_by_code(self.code).nil?
@being-frank
being-frank / snapper.sh
Last active December 12, 2015 07:29
Simple automated EBS snapshot script for creating and automatically cleaning up EBS snapshots
#!/bin/bash
# Cron example: 0 2 * * * /bin/bash /path/to/snapper.sh
# AWS Credentials
AWS_PK=/path/to/pk-xxx.pem
AWS_CERT=/path/to/cert-xxx.pem
# Array of EC2 Instance IDs
INSTANCES=('i-xxx01')
mymodule {
@at-root {
.#{&}-header { ... }
.#{&}-footer { ... }
.#{&}-body {
a { ... }
span { ... }
p { ... }
}
}
@being-frank
being-frank / pseudos.sass
Last active December 27, 2015 08:59
Pseudo class mixin
=pseudos($pseudos)
@each $pseudo in $pseudos
@if $pseudo == disabled
&:disabled,
&[disabled],
&[disabled]:hover,
&[disabled]:active,
&.pseudo-class-disabled,
&.pseudo-class-disabled:hover,
&.pseudo-class-disabled:active
@being-frank
being-frank / SassMeister-input-HTML.haml
Created February 12, 2014 08:20
Generated by SassMeister.com.
.block
%p Block
.block__element
%p Element
.block__element--modifier
%p Element with Modifier
.block__element--modifier2
%p Element with Modifier
@being-frank
being-frank / index.html
Created June 25, 2014 12:41
Manipulating display order of content using Neat
<div class="content">
<div class="content__right">This content must be first on mobile but floated to the right on a bigger screen</div>
<div class="content__left">This content must be last on mobile but floated to the left on a bigger screen</div>
</div>
@being-frank
being-frank / SassMeister-input-HTML.haml
Created August 21, 2014 13:00
Generated by SassMeister.com.
.econ__table
%table.data-table-container
%thead.data-table-header
%tr
%th Col 1
%th Col 2
%th Col 3
%th Col 4
%th Col 5
%th Col 6
@being-frank
being-frank / SassMeister-input-HTML.html
Created September 16, 2014 19:18
Generated by SassMeister.com.
<nav am-Nav='header'>
<ul am-Nav-List>
<li am-Nav-Item='active'><a href="#">Foo</a></li>
<li am-Nav-Item><a href="#">Bar</a></li>
</ul>
</nav>