(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| package main | |
| import ( | |
| "net/http" | |
| "database/sql" | |
| "fmt" | |
| "log" | |
| "os" | |
| ) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| == Rules == | |
| On Infrastructure | |
| ----------------- | |
| There is one system, not a collection of systems. | |
| The desired state of the system should be a known quantity. | |
| The "known quantity" must be machine parseable. | |
| The actual state of the system must self-correct to the desired state. | |
| The only authoritative source for the actual state of the system is the system. | |
| The entire system must be deployable using source media and text files. |
| require File.expand_path('../boot', __FILE__) | |
| require 'rails/all' | |
| if ar_initdb = ActiveRecord::Railtie.initializers.find {|item| item.name == 'active_record.initialize_database'} | |
| ActiveRecord::Railtie.initializers.delete(ar_initdb) | |
| ActiveRecord::Railtie.initializer :after => ar_initdb.after do | |
| ActiveSupport.on_load(:active_record) do | |
| self.configurations = Rails.application.config.database_configuration |
| basedn = "uid=foo,ou=bar,c=baz" | |
| attrs = ["mail", "cn", "sn", "objectclass"] | |
| ldap.search(:base => basedn, :attributes => attrs) do |entry| | |
| puts "DN: #{entry.dn}" | |
| entry.each do |attr, values| | |
| puts "#{attr}:" | |
| values.each do |value| | |
| puts "#{value}" | |
| end | |
| end |
| class Net::LDAP | |
| def initialize(args = {}) | |
| @host = args[:host] || DefaultHost | |
| @port = args[:port] || DefaultPort | |
| @verbose = false # Make this configurable with a switch on the class. | |
| @auth = args[:auth] || DefaultAuth | |
| @base = args[:base] || DefaultTreebase | |
| encryption args[:encryption] # may be nil |
GitHub::SQL has been released as an officially-maintained project and ruby gem: github/github-ds.
| BEFORE: | |
| sam@ubuntu discourse % rm -fr tmp/cache | |
| sam@ubuntu discourse % rm -fr public/assets | |
| sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile | |
| 58.55s user 1.79s system 100% cpu 1:00.02 total | |
| AFTER: |
| # config/locales/en.yml | |
| en: | |
| exception: | |
| show: | |
| not_found: | |
| title: "Not Found" | |
| description: "The page you were looking for does not exists." | |
| internal_server_error: | |
| title: "Internal Server Error" |