Skip to content

Instantly share code, notes, and snippets.

View wouterw's full-sized avatar
🎯
Focusing

Wouter Willaert wouterw

🎯
Focusing
  • Bruges, Belgium
  • 10:41 (UTC +02:00)
View GitHub Profile
@nettofarah
nettofarah / newrelic_instrumenter.rb
Created March 13, 2017 21:46
sample newrelic instrumenter for graphql-ruby
# 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
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)
import React, { Component, PropTypes } from 'react'
import {
Text,
View,
ScrollView
} from 'react-native'
import Redirect from 'react-router/Redirect'
import Match from 'react-router/Match'

This document has moved!

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.

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.
@peanav
peanav / .tmux.conf
Created December 15, 2015 17:25
My tmux.conf
# 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
@staltz
staltz / first.js
Created December 10, 2015 19:59
Tiny Cycle.js 0
Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
.subscribe(text => {
const container = document.querySelector('#app');
container.textContent = text;
});
@staltz
staltz / tiny-cycle-2.js
Created December 10, 2015 19:46
Tiny Cycle.js 2
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => {
return {
tagName: 'h1',
children: [`Seconds elapsed ${i}`]
}
})
}
@staltz
staltz / tiny-cycle-1.js
Created December 10, 2015 18:53
Tiny Cycle.js 1
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
};
}
const drivers = {
DOM: function DOMDriver(sink) {
sink.subscribe(text => {
@fishcakez
fishcakez / simple_sup.ex
Last active March 22, 2018 17:28
Examples of supervision trees for `:simple_one_for_one` supervisors
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