Skip to content

Instantly share code, notes, and snippets.

module Invocing
module Queries
class FindClientInvoiceByOrder
dependency :client_invoice_dao, ClientInvoice
def call(order_id)
ClientInvoice.includes(:line_items).find_by(order_id: order_id)
#!/usr/bin/env bash
set -eo
exit 0
echo "Logging in..."
code-push login --accessKey $CODEPUSH_ACCESS_KEY
export default class Main extends Component {
// currentUser stuff is in the state...
render() {
const AppNavigator = createRootNavigator();
return (
<SessionContext.Provider value={this.state}>
{
rules: [
{
pattern: '/db/migrations/.*',
items: [
'Have you verified x',
'Have you verified y'
]
}
]
module Values
module Support
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# Defines a new value_attribute
public class Exercise {
public static void main(String[] args) {
Node root = new Node(10);
// I have no idea if this code works, would be sensible to write a unit test
// this would be easy to do by using the comparable interface, ie build the desired tree
// then simply compare them
root.addValue(15);
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
public class ArrayIterator implements Iterator<T> {
// Set local variables
private T[][] array2D;
private int pos = 0; // The position of our cursor
module SomeDomain
class SomeProcess < Service
dependency :find_user, Users::Queries::FindByEmail
dependency :save_user, Users::Commands::Save
def call(email, some_argument)
user = find_user.(email)
if user.some_thing?(some_argument)
module Pets
class Dog
def bark
raise 'Calling the abstract pet'
end
end
module DependencySupport
def self.included(base)
base.extend(ClassMethods)
end
# Substitutes a give dependency with a provided value
# will raise an exception if a provided dependency is missing
# @param [Sumbol] dependency_name
# @param [*] value