Skip to content

Instantly share code, notes, and snippets.

View denmarkin's full-sized avatar

Den Markin denmarkin

  • Rev.com, Inc
  • Carlsbad, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am denmarkin on github.
  • I am denmarkin (https://keybase.io/denmarkin) on keybase.
  • I have a public key ASCpGeeJGVUX_VHJR-x-QXpS-IOj0NY-aqqjU8_n0oYkcwo

To claim this, I am signing this object:

@denmarkin
denmarkin / read_uncommitted.sql
Created November 16, 2012 19:09
Allow read from locked MSSQL table during debug of test inside transactions
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
@denmarkin
denmarkin / common_steps.rb
Created November 2, 2011 17:15
Cucumber + Capybara HTML table comparison from http://railscasts.com/episodes/186-pickle-with-cucumber
Then(/^I should see (.+) table$/) do |table_id, expected_table|
html_table = table_at("##{table_id.parameterize.tableize}").to_a
html_table.map! { |r| r.map! { |c| c.gsub(/<.+?>/, '').gsub(/[\n\t\r]/, '') } }
expected_table.diff!(html_table)
end
@denmarkin
denmarkin / wd_world.log
Created October 20, 2011 14:43
My Book World (White Light) firmware 01.02.12 icompatibility of Berkeley DB lib from OSX Lion
10/20 13:43:40 MyBookWorld daemon.err afpd[4173]: Can't open volume "/DataVolume/.timemachine" CNID backend "cdb"
10/20 13:43:40 MyBookWorld daemon.err afpd[4173]: Cannot open CNID db at [/DataVolume/.timemachine].
10/20 13:43:40 MyBookWorld daemon.err afpd[4173]: cnid_open: dbenv->open of /DataVolume/.timemachine/.AppleDB failed: DB_VERSION_MISMATCH: Database environment version mismatch
10/20 13:43:40 MyBookWorld daemon.err afpd[4173]: cnid_open: dbenv->open (rw) of /DataVolume/.timemachine/.AppleDB failed: DB_VERSION_MISMATCH: Database environment version mismatch
10/20 13:43:39 MyBookWorld daemon.notice afpd[4173]: AFP3.3 Login by WD_Backup
10/20 13:38:24 MyBookWorld daemon.info wixEvent[3626]: Network IP Address - NIC 1 use static IP address 192.168.1.60
10/20 13:38:23 MyBookWorld daemon.warn wixEvent[3626]: Volume Used - Volume 'DataVolume' had reached 80% capacity.
10/20 13:38:06 MyBookWorld daemon.info wixEvent[3626]: Network Link - NIC 1 link is up 100 Mbps full duplex.
10/20 13:36:2
@denmarkin
denmarkin / application_helper.rb
Created October 14, 2011 08:17
Shared errors for multiple targets (when you need render errors for a form containing nested or unlinked )
def collect_shared_error_messages(target)
targets = []
error_messages = []
if target.kind_of?(Array)
target.collect {|t| targets << t}
else
targets << target
end
targets.each do |target|
target.errors.full_messages.collect {|msg| error_messages << msg} if target.errors.any?
@denmarkin
denmarkin / nginx
Created October 6, 2011 13:29 — forked from mdominiak/nginx
nginx start up script for ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@denmarkin
denmarkin / config_initializers_sass.rb
Created October 6, 2011 08:03 — forked from grk/config_initializers_sass.rb
Sass load paths Rails 3.1
Sass::Engine::DEFAULT_OPTIONS[:load_paths].tap do |load_paths|
load_paths << "#{Rails.root}/app/assets/stylesheets"
load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
load_paths << "#{Gem.loaded_specs['html5-boilerplate'].full_gem_path}/stylesheets"
load_paths << "#{Gem.loaded_specs['fancy-buttons'].full_gem_path}/lib/stylesheets"
end
@denmarkin
denmarkin / resque.rake
Created September 20, 2011 11:02
My rake task for clearing Resque queues and stats
# see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version
# see https://github.com/defunkt/resque/issues/49
# see http://redis.io/commands - new commands
namespace :resque do
desc "Clear pending tasks"
task :clear => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
@denmarkin
denmarkin / monit_rake.sh
Created June 22, 2011 15:48
monit + resque management (from @Mindwork)
#!/bin/sh
# wrapper to daemonize rake tasks: see also http://mmonit.com/wiki/Monit/FAQ#pidfile
usage() {
echo "usage: ${0} [start|stop] name target [arguments]"
echo "\tname is used to create or read the log and pid file names"
echo "\tfor start: target and arguments are passed to rake"
echo "\tfor stop: target and arguments are passed to kill (e.g.: -n 3)"
exit 1
}
[ $# -lt 2 ] && usage
@denmarkin
denmarkin / payments_controller.rb
Created May 29, 2011 11:00
Example of ActiveMerchant Express Checkout request construction
amount = thing.build_payment.price_in_cents
response = EXPRESS_GATEWAY.setup_authorization(amount,
:ip => request.remote_ip,
:return_url => new_payment_url,
:cancel_return_url => new_order_url,
:no_shipping => true,
:items => [{:name => "#{thing.title}", :amount => amount}]
)