OS X Mavericks, failing specs and libxml
3 Quick Tips for Coding with OS X 10.9 Mavericks Some good tips on homebrew and xcode to get compiling working
Install Ruby on Rails · Mac OS X Mavericks RVM / Homebrew / Git
- name: ensure github.com is a known host | |
lineinfile: | |
dest: /root/.ssh/known_hosts | |
create: yes | |
state: present | |
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}" | |
regexp: "^github\\.com" |
//*********** IMPORTS ***************** | |
var gulp = require('gulp'); | |
var sass = require('gulp-ruby-sass'); | |
var gutil = require('gulp-util'); | |
var rename = require("gulp-rename"); | |
var map = require("map-stream"); | |
var livereload = require("gulp-livereload"); | |
var concat = require("gulp-concat"); | |
var uglify = require('gulp-uglify'); | |
var watch = require('gulp-watch'); |
class UserAdder < Struct.new(:user_params, :company_id, :role) | |
extend FriendlyMethodObject | |
def initialize(*) | |
super | |
# Provide defaults for optional members | |
self.role ||= :default_role | |
end | |
def call |
class UserController < ActionController::Base | |
def new | |
@user = User.new | |
end | |
def create | |
result = SignupUser.call(params[:user]) | |
if result.successful? | |
redirect_to root_url, notice: "A welcome e-mail is on it's way!" |
# app/models/concerns/multiparameter_attribute_assignment.rb | |
module MultiparameterAttributeAssignment | |
include ActiveModel::ForbiddenAttributesProtection | |
def initialize(params = {}) | |
assign_attributes(params) | |
end | |
def assign_attributes(new_attributes) |
OS X Mavericks, failing specs and libxml
3 Quick Tips for Coding with OS X 10.9 Mavericks Some good tips on homebrew and xcode to get compiling working
Install Ruby on Rails · Mac OS X Mavericks RVM / Homebrew / Git
# An abstract base class used to create simple serializers | |
# for ActiveRecord objects | |
class BaseSerializer | |
include Rails.application.routes.url_helpers | |
attr_reader :serialized_object | |
def initialize(serialized_object) | |
@serialized_object = serialized_object | |
end |
generator-webapp
has support for compass out of the box. However, in order to use one of my favorite features of it — sprites and the image_url
helper — you have to make some adjustments to the Gruntfile
.
Let's assume you use a SASS stylesheet like this one:
@import "design/*.png"
{ | |
"Statement": [ | |
{ | |
"Action": [ | |
"route53:ChangeResourceRecordSets", | |
"route53:GetHostedZone", | |
"route53:ListResourceRecordSets" | |
], | |
"Effect": "Allow", | |
"Resource": [ |
jQuery.fn.selectTimeZone = function() { | |
var $el = $(this[0]); // our element | |
var offsetFromGMT = String(- new Date('1/1/2009').getTimezoneOffset() / 60); // using 1/1/2009 so we know DST isn't tripping us up | |
if (offsetFromGMT[0] != '-') { | |
offsetFromGMT = '+' + offsetFromGMT; // if it's not negative, prepend a + | |
} | |
if (offsetFromGMT.length < 3) { | |
offsetFromGMT = offsetFromGMT.substr(0, 1) + '0' + offsetFromGMT.substr(1); // add a leading zero if we need it | |
} | |
var regEx = new RegExp(offsetFromGMT); // create a RegExp object with our pattern |