(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.
(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" |
$("button.mark-all-as-read").parent().prepend('<button class="box-action mute-all-unread css-truncate tooltipped upwards" original-title="mute all unread notifications"> <span class="octicon octicon-mute"></span> </button>'); | |
$('button.mute-all-unread').click(function(event) { | |
// mute all unread notifications | |
$(this).parent().parent().parent().find('li.unread').find('.js-mute-notification button').click(); | |
return false; | |
}); |