This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rgb_to_hsv(r, g, b) | |
if r == b && r == g | |
h = s = 0 | |
v = (0.299 * r + 0.587 * g + 0.114 * b) / 255 | |
else | |
max = [r, g, b].max.to_f | |
min = [r, g, b].min.to_f | |
v = max | |
s = min |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Re-run a command whenever a file in directory is changed! | |
# | |
# Inspired by: http://ngauthier.com/2012/02/quick-tests-with-bash.html | |
# Thanks Nick! | |
# | |
# Patrick Helm (me@patrick-helm.de), 2013 | |
# | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
OlderNewer