It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
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
# NewRelic instrumenter for GraphQL-ruby | |
# | |
# In your controller: | |
# ::NewRelic::Agent.add_custom_attributes({ | |
# user_id: @user.try(:id), | |
# query_string: @query_string, | |
# query_arguments: @query_variables | |
# }) | |
# | |
# @document = self.class.trace_execution_scoped(["GraphQL#parse"]) do |
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
require 'rails_event_store' | |
require 'aggregate_root' | |
PaymentAuthorized = Class.new(RailsEventStore::Event) | |
PaymentSuccessed = Class.new(RailsEventStore::Event) | |
PaymentFailed = Class.new(RailsEventStore::Event) | |
PaymentCaptured = Class.new(RailsEventStore::Event) | |
class Payment | |
InvalidOperation = Class.new(StandardError) |
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
import RxSwift | |
// MARK: - pausable | |
extension ObservableType { | |
/** | |
Pauses the underlying observable sequence based upon the observable sequence which yields true/false. | |
- parameter pauser: The observable sequence used to pause the underlying sequence. |
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 ESC work right | |
set -sg escape-time 0 | |
# Make the colors work right | |
set -g default-terminal "screen-256color" | |
# set window and pane index to 1 (0 by default) | |
set-option -g base-index 1 | |
setw -g pane-base-index 1 |
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
Rx.Observable.timer(0, 1000) | |
.map(i => `Seconds elapsed ${i}`) | |
.subscribe(text => { | |
const container = document.querySelector('#app'); | |
container.textContent = text; | |
}); |
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 main() { | |
return { | |
DOM: Rx.Observable.timer(0, 1000) | |
.map(i => { | |
return { | |
tagName: 'h1', | |
children: [`Seconds elapsed ${i}`] | |
} | |
}) | |
} |
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 main() { | |
return { | |
DOM: Rx.Observable.timer(0, 1000) | |
.map(i => `Seconds elapsed ${i}`) | |
}; | |
} | |
const drivers = { | |
DOM: function DOMDriver(sink) { | |
sink.subscribe(text => { |
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
defmodule SimpleSup do | |
@moduledoc """ | |
This file shows methods for starting a configurable number of children under | |
a `:simple_one_for_one` supervisor. | |
When the supervision tree is first started all methods behave the same, `size` | |
children are started and the `:starter` returns `:ignore`. However if the | |
restart limit for those children is reached the `:simple_one_for_one` | |
supervisor will be restarted and then the `:starter`. It is possible that the | |
`:simple_one_for_one` is restarted successfully but the `:starter` fails to |