Skip to content

Instantly share code, notes, and snippets.

class SimpleGit
def self.git(method_name, cmd = nil)
define_method(method_name) do |args|
if cmd
git("#{cmd} #{args}")
else
git("#{method_name} #{args}")
end
end
end
@Deradon
Deradon / keybase.md
Created April 11, 2016 11:39
keybase.md

Keybase proof

I hereby claim:

  • I am deradon on github.
  • I am deradon (https://keybase.io/deradon) on keybase.
  • I have a public key ASDFN4LtplWTjsgQj6hYnDzKYpzOJmp840GkZnaf3J1sHgo

To claim this, I am signing this object:

@Deradon
Deradon / flowdock.rb
Created November 9, 2015 14:30
flowdock
class WimduFlowdockPullRequestService
TOKEN = Rails.application.secrets.flowdock_api_token
FLOW_ID = Rails.application.secrets.flowdock_flow_id
OCTOCAT = ":octocat:"
def self.run(*args)
new(*args).run
end
def initialize(event)
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.de"><img alt="Creative Commons Lizenzvertrag" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a>
@Deradon
Deradon / hmb8.rb
Created June 5, 2013 19:36
Humble Indie Bundle 8 - Stats
# Patrick Helm - @htwk_pat - 2013
#
# Humblde Bundle 8 - 05.06.2013
#
# Stats - Estimate purchases per plattform
total_payments = 2174259.44
purchases = 378038
average_purchase = 5.75
@Deradon
Deradon / spec_helper.rb
Created February 20, 2013 22:06
Sample Rails::Engine spec_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'active_scaffold'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
@Deradon
Deradon / Rakefile
Created February 20, 2013 22:05
Samle Rails::Engine Rakefile
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
@Deradon
Deradon / engine_gemspec.rb
Created February 20, 2013 22:01
Sample gemspec for Rails::Engine
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "cmf_raffle_widget/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "cmf_raffle_widget"
s.version = CmfRaffleWidget::VERSION
s.authors = ["Patrick Helm"]
@Deradon
Deradon / touchpad-disable.rb
Created February 8, 2013 00:29
HP-Notebook - Disable/Enable touchpad on command-line
#!/usr/bin/env ruby
# Simple script to disable TouchPad on HP-Notebook
#
# Usage: touchpad-disable
#
# Installation: save file to ~/bin/touchpad-disable (may chmod +X it)
#
def run(cmd, options = {:show => true})
puts "> #{cmd}"
@Deradon
Deradon / git_fix.rb
Last active September 12, 2016 21:55
Simple git-snippet to commit a small fix with auto-generated commit-message.
#!/usr/bin/env ruby
# Author: Patrick Helm (deradon87@gmail.com), 2013
#
#
# Simple git-snippet to commit a small fix with auto-generated commit-message.
#
# ## Description
#
# I noticed, we developers often needs to fix a small typo or do something