Skip to content

Instantly share code, notes, and snippets.

# app/controllers/spree/checkout_controller_decorator.rb
Spree::CheckoutController.class_eval do
after_action :after_order_processing
def after_order_processing
# This doesn't seem to be called either. Also I would have to check the
# current state each time this ran for the 'complete' state
binding.pry
end
end
@dfreerksen
dfreerksen / .template.rb
Last active April 15, 2016 05:54
Rails application template
# coding: utf-8
# Rails init template
#
# Usage
#
# $ rails new app_name -m https://gist.githubusercontent.com/dfreerksen/0270bbb7cf153497d5dce6b691c747e2/raw/.template.rb
# Gemfile
run "rm Gemfile"
get "https://gist.githubusercontent.com/dfreerksen/0270bbb7cf153497d5dce6b691c747e2/raw/Gemfile", "Gemfile"
AllCops:
Include:
- Rakefile
- config.ru
Exclude:
- "bin/**/*"
- "db/schema.rb"
- "db/migrate/**/*"
- "spec/dummy/**/*"
- "vendor/**/*"
@dfreerksen
dfreerksen / .editorconfig
Last active August 16, 2018 02:54
.editorconfig for Ruby projects
# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
def hello
"world"
end
@dfreerksen
dfreerksen / Environment.php
Created August 16, 2012 03:15
PHP Environment class
<?php
class Environment {
/**
* Current environment
*
* @var string
*/
static protected $env;
@dfreerksen
dfreerksen / Input.php
Created August 17, 2012 15:54
PHP Input class
<?php
class Input {
/**
* Protocol (http or https)
*
* @return string
*/
static public function protocol() {
@dfreerksen
dfreerksen / Date.php
Created January 26, 2013 22:11
PHP Date
<?php
/**
* Date class
*/
class Date {
/**
* Fuzzy date strings
*
* @var array
@dfreerksen
dfreerksen / Crypt.php
Created August 27, 2012 14:16
PHP Crypt class
<?php
class Crypt {
/**
* The encryption cipher
*
* @var string
*/
static public $cipher = MCRYPT_RIJNDAEL_256;
@dfreerksen
dfreerksen / Curl.php
Created August 17, 2012 16:19
PHP Curl helper class (PHP 5.2+)
<?php
class Curl {
/**
* cURL request method
*
* @var string
*/
protected $_method = 'GET';