Skip to content

Instantly share code, notes, and snippets.

Christoph Lupprich clupprich

Block or report user

Report or block clupprich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View github_actions_formatter.rb
# Use it like so:
# > bundle exec {rubocop, standardrb} --require ./lib/github_actions_formatter.rb --format GithubActionsFormatter
class GithubActionsFormatter < RuboCop::Formatter::BaseFormatter
def file_finished(file, offenses)
return unless (uncorrected_offenses = offenses.reject(&:corrected?)).any?
uncorrected_offenses.each do |o|
output.printf("::error file=%s,line=%d,col=%d::%s\n", path_to(file), o.line, o.real_column, o.message.tr("\n", " "))
end
View rails_single_file_server.rb
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
View rails_single_file.rb
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@clupprich
clupprich / schema_matcher.rb
Last active Aug 29, 2015
JSON Schema matcher
View schema_matcher.rb
# spec/support/schema_matcher.rb
class Schema
@definitions = {}
def self.define(name, &block)
@definitions[name] = block.call
end
def self.defined?(name)
@definitions.key?(name)
View Gemfile
source 'https://rubygems.org'
gem 'bson_ext'
gem 'mongo_mapper', '0.13.1'
@clupprich
clupprich / .gitignore
Last active Aug 29, 2015
mongo-replica-test
@clupprich
clupprich / gist:8c1d85c1c3ce79767875
Created Dec 19, 2014
Write CouchDB stats into DB with current timestamp
View gist:8c1d85c1c3ce79767875
curl -s -X GET http://localhost:5984/_stats | echo "[$(cat -), { \"datetime\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\" }]" | jq '.[0] + .[1]' | curl -X POST -H "Content-Type: application/json" -d @- http://localhost:5984/stats
View Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
css: {
files: ['styles/*'],
tasks: ['sass', 'cssmin', 'copy:css']
},
View order.rb
# encoding:utf-8
class Order < ActiveRecord::Base
acts_as_paranoid
attr_accessible :coupon_code, :plan, :subscription, :ordered_at, :address_attributes
attr_accessor :coupon_code, :plan
has_many :line_items, dependent: :destroy
has_many :transactions, dependent: :destroy
@clupprich
clupprich / template.rb
Created Dec 7, 2013
Rails 4 Application Template
View template.rb
# Rails 4 Application Template
#
# Author: Christoph Lupprich <christoph@luppri.ch>
#
#
# Gems
gem 'devise'
gem 'cancan'
You can’t perform that action at this time.