Skip to content

Instantly share code, notes, and snippets.

View dwayne's full-sized avatar

Dwayne Crooks dwayne

View GitHub Profile
@dwayne
dwayne / exact-center.scss
Created February 19, 2014 11:48
A mixin for horizontally and vertically centering a block element.
// http://css-tricks.com/snippets/css/exactly-center-an-imagediv-horizontally-and-vertically/
@mixin exact-center($width, $height) {
width: $width;
height: $height;
position: absolute;
left: 50%;
top: 50%;
margin-left: -$width / 2;
margin-top: -$height / 2;
}
@dwayne
dwayne / 1-javascript-fundamentals-101.md
Last active August 29, 2015 13:56
Tuts+ Premium Course - JavaScript Fundamentals 101 - Notes
@dwayne
dwayne / 0-about.md
Last active August 29, 2015 13:56
My Rails preferences.

About

If I find myself doing something over and over in Rails or if I come across a good best practice, then I'd document it here for future reference.

@dwayne
dwayne / _kfc_nav_bar.html.erb
Created April 18, 2014 00:17
Just playing around with KFC T&T navigation bar.
<div class="kfc-navbar kfc-navbar-with-logo">
<div class="kfc-navbar-logo">
<a href="#" title="KFC T&T - So Good!">KFC T&amp;T</a>
</div>
<div class="kfc-nav-outer-wrapper">
<div class="kfc-nav-inner-wrapper">
<nav class="kfc-nav">
@dwayne
dwayne / _vertical-center.scss
Last active August 29, 2015 14:02 — forked from denzildoyle/Vertical Center.css
Vertically center anything.
// Assumes Bourbon - See http://bourbon.io/docs/#transform
// To see it in action, check out http://codepen.io/dwayne/pen/gjDGx
@mixin vertical-center {
position: relative;
top: 50%;
@include transform(translateY(-50%));
}
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
@dwayne
dwayne / example.rb
Last active August 29, 2015 14:06
A secure random token generator with tests.
# Generating a unique auth_token for a user
#
# While a user exists with the generated token, generate a new one
Token.generate { |token| User.exists?(auth_token: token) }
@dwayne
dwayne / advice.md
Last active August 29, 2015 14:06
Suggestions from Jeff Browning at Pinecone on improving my skills at AngularJS and Rails.

AngularJS

  • Build custom directives. Basic controllers and templates are great, but anything beyond basic interactivity usually requires custom directives. The learning curve for custom directives can be challenging, so just take it one step at a time.
  • Inter-directive communication via controllers.
  • Become very familiar with scope usage, best practices, and pitfalls. Scope inheritance, and encapsulation are some of the areas where Angular can drive you insane, but this knowledge is essential in order to build large-scale, maintainable Angular apps.
  • Explore the differences between Services, Factories, and Providers.
  • Become a testing expert. One thing that I like about the Angular community is that tests are expected and encouraged.

Here are some resources to help:

@dwayne
dwayne / preface.md
Created January 21, 2015 09:47
Full Stack Web Development with Backbone.js by Patrick Mulder

Preface

The Pipefishbook

Code Examples

To be covered:

  • How to quickly get started with a Backbone.js sandbox
  • How to manage data and state with Backbone.js models
@dwayne
dwayne / workflow.md
Last active August 29, 2015 14:17
A workflow for using GitHub project pages to host a static site.

First Time

The gh-pages branch does not exist on the remote.

# Set up the build directory on an orphan branch
$ mkdir build && cd build
$ git init
$ git checkout --orphan gh-pages