Skip to content

Instantly share code, notes, and snippets.

View adz's full-sized avatar

Adam Davies adz

  • Veridapt
  • Adelaide, Australia
  • 13:26 (UTC +09:30)
  • X @adzdavies28
View GitHub Profile
@adz
adz / dryhints.rb
Last active January 24, 2017 03:55
# Schema looks like:
configure do
def iso8601?(input)
!(!Date.iso8601(input))
rescue ArgumentError
false
end
end
required(:position).filled(:int?)
@adz
adz / 0_reuse_code.js
Created September 19, 2016 02:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Newsletter
Join the Adelaide.rb here!!! https://adelaide-rb-join.herokuapp.com/Jobs
Rails Camp Adelaide tickets here!!! https://ti.to/ruby-australia/rails-camp-adelaide-2016/en
JOBS!
The following companies are looking for developers.
@adz
adz / Favourite RubyConf16 Talks.md
Last active February 14, 2016 22:58
Favourite RubyConf16 Talks
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
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:
make_user role name password =
<some code that actually makes user>
make_admin = make_user “admin”
make_admin “adz” “pa$$word”
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)
@adz
adz / make_user.js
Last active November 27, 2015 04:57
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;
# 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