I hereby claim:
- I am arthurzheng on github.
- I am junzheng (https://keybase.io/junzheng) on keybase.
- I have a public key ASBjSqeSkrMbZ6s8W8f6OkDU_G6QLOZbl8tybTUg8REEvwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Commands to keep your app healthy, Ruby and Rails gems wise.
Open new Terminal, note the gemsets showing:
rvm gemset list
You will see you are using the (default) gemset.
Keep your system up to date with rvm
and brew
:
rvm get head
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: example | |
namespace: default | |
data: | |
APPLICATION_HOST: example.com | |
LANG: en_US.UTF-8 | |
PIDFILE: /tmp/server.pid | |
PORT: "3000" |
Last year I started playing around with using memoized private helper methods in my controllers instead of the traditional instance variable assigns we see in RoR controllers. Here's an example:
class PostsController < ApplicationController
helper_method :new_post, :post, :posts
def new; end
def show; end
def edit; end
def index; end
This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).
This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This page lists the options for breaking single-line expressions into multiple lines in Ruby.
Developers and teams need to come to their own decisions about which guideline(s) they prefer (preferences below are just my personal choices and I encourage you to disregard them).
# With trailing parens
x = [1, 2, 3].join(
'-'
In Rails 4 PATCH is the new HTTP methode for an update action. You can find the details here: http://weblog.rubyonrails.org/2012/2/25/edge-rails-patch-is-the-new-primary-http-method-for-updates/
As you can imagine you need to use the PATCH method to test the update action in your controller. Because of how the users controller in this example works you need to specify the id and user. This particular spec tests whether the user gets redirected if it's not logged in.
(./spec/controllers/users_controller_spec.rb)
require 'spec_helper'
#!/usr/bin/env python | |
##### USE ON YOUR OWN RISK - THIS IS GOING TO DEREGISTER AMI OLDER THAN 30 DAYS | |
import boto3 | |
from dateutil.parser import parse | |
import datetime | |
age = 30 | |
aws_profile_name = 'prod' | |
def days_old(date): | |
get_date_obj = parse(date) |