Skip to content

Instantly share code, notes, and snippets.

View felixbuenemann's full-sized avatar
💭
I may be slow to respond.

Felix Bünemann felixbuenemann

💭
I may be slow to respond.
View GitHub Profile
# encoding: utf-8
# Simple UUID Generator for UUID v0 (zero padded), v1, v2, v3, v4, v5
# Author: Felix Buenemann https://github.com/felixbuenemann/
# License: Public Domain
# Note: v1 code partially based on these ruby uuid implementations:
# https://github.com/assaf/uuid/
# https://github.com/cassandra-rb/simple_uuid
require 'digest/md5'
require 'digest/sha1'
require 'securerandom'
diff --git a/lib/acts_as_tree.rb b/lib/acts_as_tree.rb
index 3279d87..1395481 100644
--- a/lib/acts_as_tree.rb
+++ b/lib/acts_as_tree.rb
@@ -240,7 +240,7 @@ module ActsAsTree
# subchild1.leaf? # => true
# child1.leaf? # => false
def leaf?
- children.empty?
+ children.size == 0
@felixbuenemann
felixbuenemann / ci.rake
Last active October 9, 2017 16:26
Jenkins CI Rake Task with Parallel Tests
namespace :ci do
desc 'Run rubocop for CI environment'
task :rubocop do
args = %w{
--require ./lib/rubocop/formatter/progress_formatter_no_report
--format Rubocop::Formatter::ProgressFormatterNoReport
--require rubocop/formatter/checkstyle_formatter
--format Rubocop::Formatter::CheckstyleFormatter
--rails
--fail-level error
diff -ur activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
--- activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb 2014-07-11 02:35:32.000000000 +0200
+++ activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb 2014-07-11 01:31:14.000000000 +0200
@@ -8,7 +8,7 @@
# Abstract representation of an index definition on a table. Instances of
# this type are typically created and returned by methods in database
# adapters. e.g. ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#indexes
- class IndexDefinition < Struct.new(:table, :name, :unique, :columns, :lengths, :orders, :where, :type, :using) #:nodoc:
+ class IndexDefinition < Struct.new(:table, :name, :unique, :columns, :lengths, :orders, :where, :type, :using, :opclass) #:nodoc:
end
# CASE implementation for Arel
# Based on: https://github.com/take-five/acts_as_ordered_tree/blob/master/lib/acts_as_ordered_tree/transaction/dsl.rb
# Extended with support for CASE expr WHEN expr[, expr, ...] by Felix Buenemann
module Arel
module Nodes
# Case node
#
# @example
# switch.when(table[:x].gt(1), table[:y]).else(table[:z])
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'sqlite3'
GEMFILE
-- strip_md(text) - strips markdown from text
-- (c) 2014 Felix Buenemann https://github.com/felixbuenemann
-- License: Public Domain
CREATE OR REPLACE FUNCTION strip_md(input text) RETURNS text AS $$
BEGIN
-- strip html tags
input := regexp_replace(input, '<[^>]+>', '', 'g');
-- strip list leaders and blockquotes
input := regexp_replace(input, '^([\s]*)([\*\-\+]|\d\.|>)\s+', '\1', 'ng');
-- strip setext header underlines
diff --git a/actions.go b/actions.go
index 93cb126..69a4235 100644
--- a/actions.go
+++ b/actions.go
@@ -179,11 +179,18 @@ func sendEmail(e *EmailNotifier, doc bytes.Buffer) error {
} else {
util.Debug("Sending email to %s", e.To)
util.Debug("Sending email:\n%s", string(doc.Bytes()))
- auth := smtp.PlainAuth("", e.Username, e.Password, e.Host)
- err := smtp.SendMail(e.Host+":587", auth, e.From,
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.1.8'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
# This connection will do for database-independent bug reports.
" Vim color scheme
"
" Name: railscast.vim
" Maintainer: Josh O'Rourke <joshorourke@me.com>
" License: public domain
"
" A GUI Only port of the RailsCasts TextMate theme [1] to Vim.
" Some parts of this theme were borrowed from the well-documented Lucius theme [2].
" Ported for 256 color console vim by Felix Buenemann <felix.buenemann@gmail.com>
"