Skip to content

Instantly share code, notes, and snippets.

@mileer
mileer / CalculatorView.swift
Created October 17, 2015 17:30 — forked from natecook1000/CalculatorView.swift
An IBInspectable Calculator Construction Set
// CalculatorView.swift
// as seen in http://nshipster.com/ibinspectable-ibdesignable/
//
// (c) 2015 Nate Cook, licensed under the MIT license
/// The alignment for drawing an String inside a bounding rectangle.
enum NCStringAlignment {
case LeftTop
case CenterTop
case RightTop
@mileer
mileer / gist:3529bb926caaaab167ed
Last active August 29, 2015 14:26
Balsamiq Mockups 2.2.22 for mac key
Name : Sam
Serial : eJzzzU/OLi0odswsqglOzK0xsjQzNzI2NjA1q3GuMQQAnJAJjw==
@mileer
mileer / 0-post.md
Last active August 29, 2015 14:23 — forked from zacstewart/0-post.md

Breaking table–model–controller symmetry

A while ago I hit a lull in my skill advancement as a Rails developer. I had long since learned to think of my resources as resources. I did my best to limit my controller actions the basic CRUD methods. I considered the "fat model, skinny controller" mantra to be sacrosanct. But I was still often finding myself going way out of my way to implement otherwise mundane features, for example sending mail after saving an object or adding a routine accept/reject to something.

@mileer
mileer / index.md
Last active August 29, 2015 14:23 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@mileer
mileer / README.md
Last active August 29, 2015 14:23 — forked from jonathantneal/README.md

font

Define many font and text styles in one line.

.basic-usage {
	@include font( light condensed center italic slashed-zero uppercase underline 2em 1.5 500 "Helvetica Neue" "Helvetica" sans-serif );
}
@mileer
mileer / README.md
Last active August 29, 2015 14:23 — forked from jonathantneal/README.md

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
class ApplicationController < ActionController::Base
# Includes Authorization mechanism
include Pundit
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
# Globally rescue Authorization Errors in controller.
class ApplicationController < ActionController::Base
include Pundit
# Verify that controller actions are authorized. Optional, but good.
after_filter :verify_authorized, except: :index
after_filter :verify_policy_scoped, only: :index
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
private
@mileer
mileer / Ruby ORMs.md
Last active August 29, 2015 14:21 — forked from booch/Ruby ORMs.md

Ruby ORMs

Abstract

Rails is really a collection of pieces that can be put together to create a web app. You can enhance or replace many of the components - how you write views, how controllers work, and how you build models. While models are built on top of ActiveRecord in the