"ayw
yank word into the "a" register
"Ayw
yank word and append into the "a" register
z
move current line to the top
class User | |
has_many :friendships | |
has_many :friends, through: :friendships | |
end | |
class Friendship | |
belongs_to :friend, class: User | |
belongs_to :friendee, class: User | |
end |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Troop</title> | |
<%= stylesheet_link_tag 'application' %> | |
<%= javascript_include_tag 'application' %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> |
The use case I had when I implemented client SSL authentication was to secure a web interface for a centralised log service that I was running. I wanted it to have it available, securely, on the public internet. I implemented it using nginx's ssl module.
I only had this available for 4-5 developers. I think I'd only attempt to use this for anyone who is comfortable with SSH keys or if it was an API client. I think the technical bar is a little too high for anything else.
I wrote some scripts, which I've pushed to a public GitHub repository: olly/heracles. The README is a mix of actual commands that work, and thoughts for how things could be configured. The idea was for it to generate CAs, server certificates and client certificates, and store them in a git repository for easy backup. There in a fairly rough state, but what's there works and I had tested on a real setup.
I hereby claim:
To claim this, I am signing this object:
require 'minitest/autorun' | |
require 'set' | |
class Foo | |
def initialize(s) | |
@s = s | |
end | |
def ==(other) | |
@s == other |
#!/usr/bin/env ruby | |
# | |
# usage: rails-merge-db-schema <current-file> <base-file> <other-file> <marker-size> | |
# | |
# install: | |
# | |
# $ git config --global merge.railsschema.name "newer Rails schema version" | |
# $ git config --global merge.railsschema.driver "rails-merge-db-schema %A %O %B %L" | |
exit 1 if ARGV.size != 4 |
#![allow(non_upper_case_globals)] | |
#![allow(non_camel_case_types)] | |
#![allow(non_snake_case)] | |
extern crate chrono; | |
#[macro_use] | |
extern crate serde_json; | |
extern crate uuid; | |
use chrono::TimeZone; |
Prevents SQL error caused by primary_key
not being set
Previously the SelectFromDatabase
strategy connects to the database, and extracts the values, when it's initalized. However, at this stage,the table
isn't fully configured and so when it creates the source table, it doesn't set a primary key.
By changing it to lazily fetch, and cache, the values; we ensure that the source table will be correctly configured.
$ ruby test.rb 6.0.0 | |
<h1>Sample</h1> | |
=== | |
Traceback (most recent call last): | |
21: from test.rb:30:in `<main>' | |
20: from /usr/local/var/rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionview-6.0.0/lib/action_view/helpers/rendering_helper.rb:30:in `render' | |
19: from /usr/local/var/rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionview-6.0.0/lib/action_view/base.rb:304:in `in_rendering_context' | |
18: from /usr/local/var/rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actionview-6.0.0/lib/action_view/helpers/rendering_helper.rb:34:in `block in render' |