Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
(function(){
@tbonemalone
tbonemalone / gist:8386123
Last active January 3, 2016 00:59
Quick notes on rolling quick authentication for a simple rails app. Crat

This is a distilation for how to roll a simple authentication system in Rails 3.

Excellent Sources:
RailsTutorials.org
RailsCasts Episode #250

  1. Add bcrypt-ruby gem and bundle
  2. Generate controller
    1. rails g controller users
  • Note: controllers are named plural by convention
@tbonemalone
tbonemalone / .vimrc.local
Last active January 2, 2016 05:49
Local vim setting for use with [Maximum Awesome](https://github.com/square/maximum-awesome)
set nocursorline " don't highlight current line
set hlsearch "hilight search matches
set shiftround " When at 3 spaces and hit >> go to 4 not 5
"Press space to toggle highlight on/off, and show current value
nnoremap <Space> :set hlsearch! hlsearch?<CR>
"Switch between the last two files
nnoremap <leader><leader> <c-^>
@tbonemalone
tbonemalone / gist:2860373
Created June 2, 2012 22:53
html:meta:viewport tag
<snippet>
<content><![CDATA[
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>meta:viewport</tabTrigger>
</snippet>
@tbonemalone
tbonemalone / gist:2501622
Created April 26, 2012 18:20
js: validate email
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\
".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA
-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
@tbonemalone
tbonemalone / gist:2233199
Created March 29, 2012 04:01
css: normalize.css
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
HTML5 display definitions
========================================================================== */
/*
* Corrects block display not defined in IE6/7/8/9 & FF3
*/
@tbonemalone
tbonemalone / gist:2223132
Created March 28, 2012 02:50
js: underscore-js-1.3.1
// Underscore.js 1.3.1
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function() {
@tbonemalone
tbonemalone / gist:2208322
Created March 26, 2012 18:14
php: turn on error reporting
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
?>
@tbonemalone
tbonemalone / gist:2187257
Created March 24, 2012 19:49
javascript: remove commas from string of numbers
// simple remove commas from string of numbers
str.replace(/,?\s/, "");
@tbonemalone
tbonemalone / gist:2165036
Created March 22, 2012 22:17
django: import User
<snippet>
<content><![CDATA[
from django.contrib.auth.models import User
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>import user</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>