Skip to content

Instantly share code, notes, and snippets.

View mamhoff's full-sized avatar

Martin Meyerhoff mamhoff

  • Berlin
View GitHub Profile
@mamhoff
mamhoff / die_zeit_zotero.js
Created March 17, 2011 18:51
DIE ZEIT site translator for Zotero
{
"translatorID": "312bbb0e-bfb6-4563-a33c-085445d391ed",
"label": "Die Zeit",
"creator": "Martin Meyerhoff",
"target": "^http://www\\.zeit\\.de/",
"minVersion": "1.0",
"maxVersion": "",
"priority": 100,
"inRepository": "1",
"translatorType": 4,
@mamhoff
mamhoff / Der Freitag.js
Created March 18, 2011 19:02
site translator for taz.de, Potsdamer Neueste Nachrichten, Der Freitag, Süddeutsche Zeitung, Frankfurter Rundschau, Spiegel Online, Welt Online, Tagesspiegel, Le Monde Diplomatique (de)
{
"translatorID": "1ab8b9a4-72b5-4ef4-adc8-4956a50718f7",
"label": "Der Freitag",
"creator": "Martin Meyerhoff",
"target": "^http://www\\.freitag\\.de",
"minVersion": "1.0",
"maxVersion": "",
"priority": 100,
"inRepository": "1",
"translatorType": 4,
@mamhoff
mamhoff / Blaetter.js
Created April 1, 2011 09:46
A site translator for www.blaetter.de, a German Politics and Political Science Journal / Monthly
{
"translatorID": "e8e10bd4-fd6f-4297-a060-a8e0a479043f",
"label": "Blaetter fuer deutsche und internationale Politik",
"creator": "Martin Meyerhoff",
"target": "^http://www\\.blaetter\\.de",
"minVersion": "1.0",
"maxVersion": "",
"priority": 100,
"inRepository": "1",
"translatorType": 4,
@mamhoff
mamhoff / Potsdamer Neueste Nachrichten.js
Created May 6, 2011 09:39
New Translator for Potsdamer Neueste Nachrichten
{
"translatorID": "9405db4b-be7f-42ab-86ca-430226be9b35",
"label": "Potsdamer Neueste Nachrichten",
"creator": "Martin Meyerhoff",
"target": "^http://www.pnn.de",
"minVersion": "1.0",
"maxVersion": "",
"priority": 100,
"inRepository": "1",
"translatorType": 4,
@mamhoff
mamhoff / admins_controller.rb
Created December 2, 2013 17:08
code duplication with multiple user models
class AdminsController < ApplicationController
def new
@admin = Admin.new
end
def show
@admin = Admin.find(params[:id])
end
def create
@mamhoff
mamhoff / gist:9954522
Created April 3, 2014 13:38
Resource model migration
class AddLocations < ActiveRecord::Migration
def change
create_table :locations do |t|
t.string :title, limit: 64
t.integer :picture_id
t.string :subtitle, limit: 64
t.string :street, limit: 128
t.string :number, limit: 16
t.string :postal_code, limit: 10
t.string :city, limit: 64
@mamhoff
mamhoff / etc-init.d-unicorn
Created June 12, 2014 09:44
Init script for multiple unicorns using rbenv
#! /bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
### END INIT INFO
@mamhoff
mamhoff / products_controller_decorator_with_sorting.rb
Last active October 24, 2016 15:16
Products Controller with sort by price
module Spree
ProductsController.class_eval do
helper_method :sorting_param
alias_method :old_index, :index
def index
old_index # Like calling super: http://stackoverflow.com/a/13806783/73673
@products = @products.includes(:prices).send(sorting_scope)
end
@mamhoff
mamhoff / rubyday.md
Last active November 26, 2016 08:51
Solidus Workshop at Rubyday

Solidus Workshop

People

  • Martin Meyerhoff (@mamhoff) Solidus Core team member
  • Alessandro Lepore (@alepore) Committer for Solidus i18n gem

What is Solidus

  • eCommerce framework for Ruby on Rails
@mamhoff
mamhoff / payment methods.md
Created May 29, 2017 15:30
Payment Method refactoring PR description

Add a PaymentProvider class to model Payment Gateways with multiple Payment Methods

Currently, for historical reasons, the Solidus Source conflates the idea of a payment method and a payment gateway/provider.

When the payment system was first conceived, there were only two payment methods: "Check", which was a bogus payment method that essentially meant "We'll deal with it in cash", and "Credit Card", which had the additional complexity of needing a "Gateway" to process the credit card payments.

Things have changed since then. Companies have emerged that handle many payment methods (credit, credit card, direct debit, Apple/Android pay, SEPA). Within Solidus core, we have taken great care to allow multiple payment sources, so now we have the ability of identifying a nonce as a "Braintree token" or a "Spreedly credit card" - but we still conflate "payment method", the option a user chooses to pay, and "payment gateway", the company processing payments.

This PR changes that by moving the API calls from