Skip to content

Instantly share code, notes, and snippets.


Mark Holmberg mark-d-holmberg

View GitHub Profile
View md5sum_directory_ruby.rb
require 'digest'
files = Dir["#{Dir.pwd}/db-migrate/**/*.rb"]
sorted = { |file| Digest::MD5.file(file).hexdigest }.sort
content = ""
sorted.each { |k| content << "#{k}\n" }
View gist:b3f3f57ae845b9890a0f441c3d8937e0
bash_prompt_command() {
local K="\[\033[0;30m\]" # black
local R="\[\033[0;31m\]" # red
local G="\[\033[0;32m\]" # green
local Y="\[\033[0;33m\]" # yellow
local B="\[\033[0;34m\]" # blue
local M="\[\033[0;35m\]" # magenta
local C="\[\033[0;36m\]" # cyan
local W="\[\033[0;37m\]" # white
local NONE="\[\033[0m\]"
mark-d-holmberg / simple_form.rb
Created Jan 22, 2016
Simple Form Bootstrap Ruby Engine Config
View simple_form.rb
# lib/my-engine/simple-form.rb
require 'simple_form'
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
View panels.sublime-snippet
%h4 ${1:General Information}
${2:Content Here}
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
View apache.conf
# Force SSL
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
mark-d-holmberg /
Created Sep 11, 2014
Copy files recursively
for i in `find . -name "feature-*" -type d`; do
nice=`echo $i | sed 's!^\.\/!\/!g'`;
pushd /Users/mark/Desktop/test$nice;
mv *.html ~/dev/stuff/app/views/feature/;
mv *.js ~/dev/stuff/app/assets/javascripts/;
mv css *.css ~/dev/stuff/app/assets/stylesheets/;
mv *.jpg *.png *.gif ~/dev/stuff/app/assets/images/;
View Default(OSX).sublime-keymap
{ "keys": ["super+shift+down"], "command": "select_lines", "args": {"forward": true} },
mark-d-holmberg / 3310-binary-coins.cpp
Created May 26, 2014
This demonstrates how a binary monetary system is clearly superior to our USD.
View 3310-binary-coins.cpp
/* {{{
* Mark Holmberg :
* Purpose: calculate the average number of coins needed to make change
* Tue Oct 13 15:46:34 MDT 2009
* CS 3310 : Discrete Math
* }}} */
#include <iostream>
#include <vector>
mark-d-holmberg / maintenance
Created Dec 30, 2013
This is an apache file for turning on Maintenance Mode
View maintenance
RewriteEngine On
RewriteLog /var/log/apache2/jrop-rewrite.log
RewriteLogLevel 0
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
mark-d-holmberg / spec_helper.rb
Last active Dec 25, 2015 — forked from pauljamesrussell/spec_helper.rb
Allows it to test accepts_nested_attributes_for with associations that are a `has_one`
View spec_helper.rb
# See:
# Use: it { should accept_nested_attributes_for(:association_name).using_has_one(true).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })}
RSpec::Matchers.define :accept_nested_attributes_for do |association|
match do |model|
@model = model
@nested_att_present = model.respond_to?("#{association}_attributes=".to_sym)
if @nested_att_present && @reject
@reject_success = model.send("#{association}").empty?
You can’t perform that action at this time.