Skip to content

Instantly share code, notes, and snippets.

View mdarby's full-sized avatar
💭
pending validation

Matt Darby mdarby

💭
pending validation
View GitHub Profile
@mdarby
mdarby / update.rb
Last active October 10, 2018 18:43
# frozen_string_literal: true
class ListingDescriptionUpdater
class << self
def update
file = ''
# Commented out the array of Place, Event, Job because Events and Jobs are required to have descriptions at point of creation so there should not be anything needed to be scraped from a site.
# If in the future the description field is no longer a required field they can be added back as shown below.
# [Place, Event, Job].each do |klass|
[Place].each do |klass|
@mdarby
mdarby / config_puma.rb
Created August 15, 2016 18:01 — forked from acrookston/config_puma.rb
puma config for rvm, capistrano 3 and upstart. Tested on Ubuntu 12.04 LTS and 14.04 LTS
#!/usr/bin/env puma
app_path = '/var/www/YOUR_APP_NAME/current'
directory app_path
environment 'production'
daemonize true
pidfile "#{app_path}/tmp/pids/puma.pid"
state_path "#{app_path}/tmp/pids/puma.state"
stdout_redirect "#{app_path}/log/puma_error.log", "#{app_path}/log/puma_access.log", true
threads 0,16
  1. On Rackspace Public Cloud, create an 8GB General Server with Ubuntu 14.04 PVHM.
  2. SSH in as root. If you are really cool, use tmux at this time.
  3. Install OpenStack Liberty
    bash <(curl -s https://raw.githubusercontent.com/openstack/openstack-ansible/liberty/scripts/run-aio-build.sh)
    
  4. Once complete, you can find the admin password in /root/openrc. Save it for later to log into Horizon.
  5. Fix the neutron endpoint to work with the SDK:
  6. lxc-ls | grep utility.
  7. lxc-attach -n aio1_utility_container-XXX. Replace XXX with the name you found in the last step.
# They do different things. exec replaces the current process with the new process.
# system invokes another process and returns its exit value to the current process.
# backticks invokes another process and returns the output of that process to the current process.
while true
puts `bundle exec rspec 'spec/dev_free_ipad_idempotent_spec.rb'`
end
%span.btn-group.add-item-expanded
= link_to 'View', account_select_event_item_path(item.account, item.select_event, item), method: :get, :class => "btn fooda-white"
= form_for :info, url: checkout_items_path do |f|
= f.hidden_field :parent_id, value: @menu_page.select_event.id
= f.hidden_field :parent_type, value: 'SelectEvent'
= f.hidden_field :item_id, value: item.inventory_item_id
= f.hidden_field :item_type, value: "InventoryItem"
= f.text_field :instructions
= f.text_field :options
= f.submit 'Buy Now', :class => "btn fooda-blue"
@mdarby
mdarby / gist:9141936
Created February 21, 2014 19:43 — forked from aahmad/gist:9141909
if !params[:searchable].present?
params[:searchable] = {}
end
params[:searchable][:account_id] = @account.id
@mdarby
mdarby / object-watch.js
Created September 2, 2012 03:53 — forked from eligrey/object-watch.js
object.watch polyfill
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@mdarby
mdarby / heroku_db_migrate.rb
Created August 4, 2012 15:31 — forked from urfolomeus/heroku_db_migrate.rb
Quick script to migrate heroku apps to the new free individual postgres DBs
## README
# This is a quick script I hacked out to migrate all my heroku apps
# to the new free individual postgres DBs. To use it:
# - install the heroku gem if you don't already have it
# - set the value of IGNORE_OTHERS_APPS to true if you only want to
# run the script against apps you've created yourself
# - add any apps you want to ignore because they don't use PostgreSQL
# (or for any other reason) to the IGNORE_LIST
## CAVEAT!!
@mdarby
mdarby / hack.sh
Created March 31, 2012 23:32 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@mdarby
mdarby / gist:1334638
Created November 2, 2011 19:31 — forked from bramhaghosh/gist:1334453
something stupid w/ polymorphic associations
class Deal < ActiveRecord::Base
belongs_to :store
has_many :categories, :as => :categorizable
end
class Store < ActiveRecord::Base
has_many :deals
has_many :categories, :as => :categorizable
has_many :coupons, :through => :categories
end