Skip to content

Instantly share code, notes, and snippets.

View cpetschnig's full-sized avatar

Christoph Petschnig cpetschnig

  • SINC GmbH
  • Leipzig, Germany
  • 07:09 (UTC +02:00)
View GitHub Profile
@cpetschnig
cpetschnig / gist:3952049
Created October 25, 2012 11:15
Proposal for better structure of seeds in Rails engines
Engine
======
File structure:
EngineFoo
- app
- db
- seeds.rb
@cpetschnig
cpetschnig / gist:c2dfbc7a4890635bd362
Created December 16, 2014 08:00
Git tag operations
# fetch remote tags:
$ git fetch --tags origin
# list all remote tags:
$ git ls-remote --tags
# list all major version tags:
$ git ls-remote --tags | grep -oe "refs/tags[^\^]*" | uniq | grep -E "v2[0-9][0-9][0-9]-[0-9][0-9]$"
# delete all non-version tags:
@cpetschnig
cpetschnig / gist:71d1323dda3276d55414
Created January 7, 2015 16:45
Configuration concept
module MyEngine
class Engine < ::Rails::Engine
# Autoload from the lib directory
config.autoload_paths << File.expand_path('../../', __FILE__)
config.my_engine = MyEngine::Configuration.new
# default configuration
config.my_engine.foo.class_for_bar = MyEngine::Bar
@cpetschnig
cpetschnig / rack_api_logger.rb
Created February 25, 2015 09:41
Log more information about API request in your Rails application
# Put the following line into the config section in config/application.rb:
#
# config.middleware.use RackAPILogger
class RackAPILogger
def initialize(app)
@app = app
end
def call(env)
@cpetschnig
cpetschnig / calender.rb
Created January 4, 2016 12:16
Creates a structure for your custom spreadsheet calender
# encoding: UTF-8
require 'active_support/all'
MONTHS = %w(Januar Februar März April Mai Juni Juli August September Oktober November Dezember)
DAYS = %w(So Mo Di Mi Do Fr Sa)
year = 2016
months = (1..12).map do |month|

Keybase proof

I hereby claim:

  • I am cpetschnig on github.
  • I am cpetschnig (https://keybase.io/cpetschnig) on keybase.
  • I have a public key whose fingerprint is 9C87 90ED 6ACD 9EF8 DE5C 06D8 B28E 2784 2E6B F4AD

To claim this, I am signing this object: