A practical example:
Whenever Foo does a network request, increment a counter in Bar.
The typical choice would be to write code inside Foo which calls method in Bar to increment the counter.
// foo.js
| #!/bin/bash | |
| rm -rf api.rubyonrails.org/ | |
| wget -r -k -p http://api.rubyonrails.org/ | |
| rm rails_api.rar | |
| rar a -r rails_api.rar api.rubyonrails.org/ |
| #!/usr/bin/env node | |
| var spawn = require('child_process').spawn; | |
| var action = 'Load'; | |
| if (process.argv[2] === '-u') { | |
| action = 'Unload'; | |
| } | |
| for (var i = 0, f = process.argv.length; i < f; i += 1) { | |
| var name = process.argv[i]; |
| -----BEGIN PGP PUBLIC KEY BLOCK----- | |
| Version: GnuPG/MacGPG2 v2.0.22 (Darwin) | |
| Comment: GPGTools - https://gpgtools.org | |
| mQENBFRJt8MBCACtqsE8GktrmbufzljppimupsRX+KMEzG5KWXJeI+xxi3QQssVt | |
| 4cLcZhAYSucsnEQiFFw0ye5VgQ/AZ3EdoMXct+2e/UExOLND5DJposPRWilLP+u1 | |
| pVW9Ko7QYg4k2y/K5dF3zyNxWAacqoyPA9NlmAY3kM1dIY9FQ3xyL/tpUaW6Zars | |
| KsDwnltDWoPde+tb4Eak6+rtX3KpQUkTXnt9Q685QWCRbPa8oaMwT3wZspk6VNDD | |
| 0J2npYjanusgxUNRoTvK0Wlkn0zm4bxWJPqh9rC8EsaUNreB4laPsJM5xI1PS15r | |
| hZBnoWENOllaD2jFXxGdw0L1FpkVJxvz1EbtABEBAAG0K0FydHVybyBHdXptYW4g |
| '.source.jsx': | |
| 'React Component': | |
| 'prefix': 'rcomp' | |
| 'body': ''' | |
| import React, { Component, PropTypes } from "react"; | |
| export default class $1 extends Component { | |
| static get propTypes() { | |
| return { | |
| }; |
| function findNamesInCommon(groupOne, groupTwo) { | |
| const groupOneNames = groupOne.map(function (person) { | |
| return person.get('name'); | |
| }); | |
| const groupTwoNames = groupTwo.map(function (person) { | |
| return person.get('name'); | |
| }); | |
| const namesInCommon = groupOneNames.filter(function (g1Name) { |
| // @flow | |
| import { flow } from 'lodash'; | |
| import { fromJS, Map } from 'immutable'; | |
| import type { User, ValidationErrors, WidgetAction } from 'pivot/types'; | |
| import * as t from './types'; | |
| import * as actions from './actions'; | |
| const EMPTY_ERRORS = new Map(); |
| # spec/support/capybara.rb | |
| require 'capybara/rails' | |
| require 'capybara/rspec' | |
| # port and url to webpack server | |
| WEB_TEST_PORT = '5005'.freeze | |
| WEB_TEST_URL = "http://localhost:#{WEB_TEST_PORT}".freeze | |
| def capybara_wait_for_webpack_server | |
| 10.times.each do |_| |
| ❯ mkdir src && touch src/index.js | |
| ❯ npm init | |
| ❯ npm install --save-dev neutrino neutrino-preset-elm |