Skip to content

Instantly share code, notes, and snippets.

View durandom's full-sized avatar
😶
my dog's got no nose

Marcel Hild durandom

😶
my dog's got no nose
View GitHub Profile
#!/usr/bin/env ruby
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'sqlite::memory:')
class Customer
Process: OOoPython [44846]
Path: /Applications/LibreOffice.app/Contents/MacOS/OOoPython.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/OOoPython
Identifier: OOoPython
Version: 2.6.0 (compatibility 2.6.0)
Code Type: X86 (Native)
Parent Process: zsh [43419]
Date/Time: 2012-06-04 16:37:38.413 +0200
OS Version: Mac OS X 10.7.4 (11E53)
Report Version: 9
@durandom
durandom / cvim.config
Last active April 6, 2016 13:39
cvim.config
let blacklists = ["https://mail.google.com/*","http://localhost/*","https://docs.google.com/*","https://trello.com/*"]
site '*://github.com/*' {
unmap t
unmap r
unmap y
let hintcharacters = "asdfgqwezxcvb"
}
site '*://feedly.com/*' {
unmap j
unmap k
@durandom
durandom / add_index_to_type_column.rb
Created June 29, 2016 14:52
bundle exec add_index_to_type_column.rb db/schema.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'active_support/core_ext/string'
ARGF.each_line("create_table") do |line|
line =~ / "([^"]+)"/
table = $1
if line =~ /t.string\s+"type"/
next if line =~ /t.index \["type"\]/
# check if nothing inherits from that class
#!/usr/bin/env ruby
require 'rubygems'
require 'active_support/core_ext/numeric/time'
require 'date'
require 'pathname'
require 'optparse'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../../manageiq/', __FILE__)
Dir.chdir APP_ROOT
@durandom
durandom / General.txt
Last active July 7, 2016 08:19
Intellj Samples
IntelliJ IDEA is a full-featured IDE
with a high level of usability and outstanding
advanced code editing and refactoring support.
abcdefghijklmnopqrstuvwxyz 0123456789 (){}[]
ABCDEFGHIJKLMNOPQRSTUVWXYZ +-*/= .,;:!? #&$%@|^
@durandom
durandom / pre-commit.rb
Created July 7, 2016 12:52
git pre-commit hook that runs rubocop on staged files
#!/usr/bin/env ruby
# make sure you have gem 'rubocop-git' in your Gemfile
require 'readline'
def input(prompt="", newline=false)
prompt += "\n" if newline
Readline.readline(prompt, true).squeeze(" ").strip
end
@durandom
durandom / service_object.rb
Last active November 29, 2016 18:39
Service Objects MIQ
# current implementation Amazon
def raw_stop
with_provider_object(&:stop)
# Temporarily update state for quick UI response until refresh comes along
self.update_attributes!(:raw_power_state => "shutting_down")
end
# implementation with Service Object
# base class for api docs
1) ManageIQ::Providers::Azure::CloudManager::Refresher will perform a full refresh
Failure/Error: expect(actual).to eq expected_table_counts
expected: {:ext_management_system=>2, :flavor=>63, :availability_zone=>1, :vm_or_template=>12, :vm=>11, :miq_te...p=>10, :network_port=>11, :cloud_network=>6, :floating_ip=>13, :network_router=>0, :cloud_subnet=>6}
got: {:ext_management_system=>2, :flavor=>80, :availability_zone=>1, :vm_or_template=>12, :vm=>11, :miq_te...p=>11, :network_port=>11, :cloud_network=>6, :floating_ip=>13, :network_router=>0, :cloud_subnet=>6}
(compared using ==)
Diff:
@@ -3,7 +3,7 @@
@durandom
durandom / rspec
Created March 13, 2017 20:07
webmock
❯ be spring rspec ./spec/models/manageiq/providers/amazon/regions_spec.rb:2
** master - DB vmdb_test on localhost
Running via Spring preloader in process 38083
/Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/space.rb:51:in `raise_lifecycle_message': The use of doubles or partial doubles from rspec-mocks outside of the per-test lifecycle is not supported. (RSpec::Mocks::OutsideOfExampleError)
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/space.rb:11:in `proxy_for'
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/matchers/receive.rb:85:in `setup_mock_proxy_method_substitute'
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/matchers/receive.rb:43:in `setup_allowance'
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/targets.rb:46:in `define_m