Skip to content

Instantly share code, notes, and snippets.

Max Power max-power

  • Berlin
Block or report user

Report or block max-power

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
@max-power
max-power / age.rb
Last active Dec 10, 2017
Ruby Age Calculation
View age.rb
class Age
def initialize(dob)
@dob = dob
end
def now
at Time.now
end
def at(date)
View number_with_unit.rb
require 'delegate'
class NumberWithUnit < SimpleDelegator
def initialize(number, unit)
super number
@unit = unit
end
def to_s
"#{super}#{@unit}"
@max-power
max-power / phonetic.gemspec
Last active Nov 10, 2017
Phonetic Spelling: NATO, LAPD and lots more
View phonetic.gemspec
Gem::Specification.new do |s|
s.name = 'phonetic'
s.version = '0.0.1'
s.platform = Gem::Platform::RUBY
s.author = 'Kevin Melchert'
s.email = 'kevin.melchert@gmail.com'
s.summary = 'Papa - Hotel - Oscar - November - Echo - Tango - India - Charlie - Sierra - Papa - Echo - Lima - Lima - India - November - Golf'
s.description = 'Phonetic Spelling: NATO, LAPD and lots more'
s.files = ['phonetic.rb']
View din.css
.DIN.A0 { width:841mm; height:1189mm; }
.DIN.A1 { width:594mm; height: 841mm; }
.DIN.A2 { width:420mm; height: 297mm; }
.DIN.A3 { width:297mm; height: 420mm; }
.DIN.A4 { width:210mm; height: 297mm; }
.DIN.A5 { width:148mm; height: 210mm; }
.DIN.A6 { width:105mm; height: 148mm; }
.DIN.A7 { width: 74mm; height: 105mm; }
.DIN.A8 { width: 52mm; height: 74mm; }
.DIN.A9 { width: 37mm; height: 52mm; }
@max-power
max-power / attributes.rb
Last active Nov 5, 2017
Ruby attribute initialiser
View attributes.rb
class Attributes < Module
def initialize(*attr_names)
@attr_names = attr_names
define_method :attributes { attr_names }
end
private
def included(base)
super
View month.gemspec
Gem::Specification.new do |s|
s.name = 'power-month'
s.version = '0.0.4'
s.platform = Gem::Platform::RUBY
s.author = 'Kevin Melchert'
s.email = 'kevin.melchert@gmail.com'
s.summary = 'Month of Year.'
s.description = 'Super simple Month of Year implementation.'
s.files = ['month.rb']
View css_counter.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>ToC</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css" media="screen">
body {
font-family: -apple-system-font;
}
View duration.rb
class Duration
attr_accessor :from, :till
def initialize(from: nil, till: nil)
@from = from || Time.now
@till = till || Time.now
end
def seconds
(till - from).round
View schmutz.rb
module Schmutz
Types = {
feinstaub: ["\u0323", "\u0307", "\u0312"],
mettwurst: ["\u0314", "\u031C", "\u0358", "\u0353", "\u0335"],
nein_nein: ["\u0337", "\u0338", "\u0336", "\u0335", "\u20d2", "\u20d3", "\u20e5", "\u20e6", "\u20eb"]
}.freeze
Types.each do |name, runes|
define_singleton_method name do |input, prop = 0.25|
mangle(input, runes, prop)
@max-power
max-power / authorization.gemspec
Last active Aug 29, 2015
Super simple policy authentication.
View authorization.gemspec
Gem::Specification.new do |s|
s.name = 'policy-authorization'
s.version = '0.0.2'
s.platform = Gem::Platform::RUBY
s.author = 'Kevin Melchert'
s.email = 'kevin.melchert@gmail.com'
s.summary = 'Super simple policy authentication.'
s.description = 'Super simple policy authentication.'
s.files = ['authorization.rb']
You can’t perform that action at this time.