Skip to content

Instantly share code, notes, and snippets.

.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
@KenneyE
KenneyE / _css_snippets.css
Last active August 29, 2015 14:01
A handful of useful CSS snippets
/* A handful of useful CSS snippets*/
@KenneyE
KenneyE / _backbone_snippets.js
Last active August 29, 2015 14:01
A handful of useful JavaScript snippets
// Useful Backbone Snippets
@KenneyE
KenneyE / Bootstrap_setup
Created May 15, 2014 17:11
Setup steps for bootstrap
1. gem ‘bootstrap-sass’
2. mv assets/stylesheets/application.css assets/stylesheets/application.css.scss
3. in application.css.scss add @import “bootstrap”;
4. in application.js -> //= require bootstrap
5. in application.html.erb:
<%= stylesheet_link_tag 'application' %>
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
6. Tweak variables in application.css.scss
@KenneyE
KenneyE / Event trigger callback
Last active August 29, 2015 14:01
A custom callback to an event on an object call Fighter
_.extend(Fighter, {
all: [],
events: {},
on: function (eventTitle, callback) {
event[eventTitle] = this.events[eventTitle] || [];
this.events[eventTitle].push(callback);
},
trigger: function (eventTitle){
var callbacks = this.events[eventTitle];
var arg = arguments[1];
@KenneyE
KenneyE / .gitignore
Last active August 29, 2015 14:00
go-to gitignore file
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
@KenneyE
KenneyE / user.rb
Created April 26, 2014 23:57
This is the validation of a new user with a basic auth system
class User < ActiveRecord::Base
attr_reader :password
before_validation :ensure_token
validates :username, uniqueness: true
validates :username, :session_token, presence: true
validates :password, presence: true, on: :create
validates :password_digest, presence: { message: "Password can't be blank"}
validates :password, length: { minimum: 6, allow_nil: true }
@KenneyE
KenneyE / rails_template.rb
Last active August 29, 2015 14:00
Overwriting defaults in new Rails app using a template
# template.rb
# Helpful links:
# Templates doc
# http://guides.rubyonrails.org/rails_application_templates.html
# Generator docs - in particular section 9
# http://guides.rubyonrails.org/generators.html