My favourite talks from RubyConf 16, and a one liner on each.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Schema looks like: | |
configure do | |
def iso8601?(input) | |
!(!Date.iso8601(input)) | |
rescue ArgumentError | |
false | |
end | |
end | |
required(:position).filled(:int?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command_builder = rom.command # no relation given, so get builder | |
nested_command = command_builder.create(user: :users) do |user| | |
user.create(:books) | |
end | |
# equivalent: | |
nested_command = rom.command({user: :users}, [:create, [:books, [:create]]]) | |
# equivalent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
General discussion... | |
Chris: | |
meetups allows annnouncements to twitter/FB | |
need to setup? | |
Lauren: | |
-> More general social event? ED/Lauren working on over new years | |
Lauren: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make_user role name password = | |
<some code that actually makes user> | |
make_admin = make_user “admin” | |
make_admin “adz” “pa$$word” |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_user(role, name, password) | |
<some code that actually makes user> | |
end | |
class UserMaker | |
def initialize(role) | |
@role = role | |
end | |
def make(name, password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function make_user(role, name, password) { | |
<some code that actually makes user> | |
} | |
//function make_user_with_role(role) { | |
// function make_user_for_given_role(name, password) { | |
// make_user(role, name, password) | |
// } | |
// return make_user_for_given_role; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get contents of conf dir | |
- shell: ls -1 {{ nginx_conf_dir }}/*.conf | |
register: contents | |
when: nginx_sites | |
# so we can delete the ones we don't manage | |
- name: empty old confs | |
file: path="{{ item }}" state=absent | |
with_items: contents.stdout_lines | |
when: nginx_sites and item not in nginx_confs |