Skip to content

Instantly share code, notes, and snippets.

Michael muescha

  • Cologne, Germany
Block or report user

Report or block muescha

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 super.rb
# [] - Eqauls to
# ^ - Not equals to
# =~ - LIKE
# >, >=, <, <= works as expected
# Examples :
# Item.where(:colour['Red'], :quanity > 10, :price <= 200)
# Post.where(:comments_count >= 1, :taggings_count < 5)
# User.where(:country ^ 'US') # Non american users
dimus / Hash.from_xml using Nokogiri
Created Mar 17, 2010
Adding Hash.from_xml method using Nokogiri
View Hash.from_xml using Nokogiri
# USAGE: Hash.from_xml:(YOUR_XML_STRING)
require 'nokogiri'
# modified from
class Hash
class << self
def from_xml(xml_io)
result = Nokogiri::XML(xml_io)
return { => xml_node_to_hash(result.root)}
ParkinT / Rakefile
Last active Oct 7, 2015
RubyMotion Rakefile - improved workflow
View Rakefile
# -*- coding: utf-8 -*-
require 'motion/project'
# custom rake tasks
require '../raketasks/gemerator.rb'
desc "Open latest crash log"
task :log do
app = Motion::Project::App.config
View gist:3832504
#!/usr/bin/env ruby
def get_values(string, expression)
regex =\{([^\}]+)\}/) { "(?<#{$1}>\\S+)" })
(match = regex.match(string)) ? Hash[] : {}
p get_values "Alice is 23 years old", "{name} is {age} years old" #=> {"name"=>"Alice", "age"=>"23"}
niloc132 / Sample.gwt.xml
Created Oct 17, 2012
Make more premutations for both small builds and bigger builds with full stack traces. Just add debug=true to the querystring of app's url, reproduce the issue, and read the trace!
View Sample.gwt.xml
<set-property name="compiler.emulatedStack" value="true, false" />
<property-provider name="compiler.emulatedStack">
<![CDATA[return ("debug=true") != -1) ? "true" : "false";]]>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true" />
dnshl / Rakefile
Created Nov 21, 2012
Rake Task with XMLFormatter for cucumber and XSLT Document
View Rakefile
require 'gherkin/parser/parser'
require 'gherkin/formatter/json_formatter'
require 'stringio'
require "active_support/core_ext/hash/conversions"
require 'nokogiri'
class XMLFormatter < Gherkin::Formatter::JSONFormatter
def done
View gist:416e172d879304af04ad

Updating rbenv Ruby to use newer OpenSSL versions

rbenv/ruby-build don’t use Homebrew-installed versions of OpenSSL — instead, they on OS X's built-in ancient version.

This can throw OpenSSL::SSL::SSLErrors when talking to websites that enforce newer SSL/TLS protocols and ciphersuites.

1: Dependencies

carlhoerberg / gist:976228
Created May 17, 2011
How to list DataMapper enum options
View gist:976228
class Entity
include DataMapper::Resource
property :enum_property, Enum[:a, :b, :c]
Entity.enum_property.options[:flags] #=> [:a, :b, :c]
# or
Entity.enum_property.flag_option.values #=> [:a, :b, :c]
MicahChalmer / .htaccess
Last active May 1, 2016
Scripts to set up Ruby 1.9.3 on a DreamHost shared hosting account via rbenv and ruby-build, and run a Rack app with it via FastCGI.
View .htaccess
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
Sawascwoolf / webWincPartnernetChart.user.js
Created Jul 19, 2016
Zeigt die Einnahmen des Partnernetberichts "Tracking-ID Kurzbericht" in einer Grafik an
View webWincPartnernetChart.user.js
// ==UserScript==
// @name webWincPartnernetChart
// @namespace webWinc
// @include*
// @version 1
// @grant GM_setValue
// @grant GM_getValue
// @require
// @require
// ==/UserScript==
You can’t perform that action at this time.