Skip to content

Instantly share code, notes, and snippets.

View larsthegeek's full-sized avatar

James Peterson larsthegeek

  • Total Tech Shop
View GitHub Profile
@larsthegeek
larsthegeek / debian_rails_prod.md
Created October 7, 2016 02:11 — forked from brycejohnston/debian_rails_prod.md
Debian 8 (Jessie) Rails Prod Setup

Update system and install prerequisite packages

sudo apt-get update && apt-get dist-upgrade
sudo apt-get install open-vm-tools # VMware VMs Only
sudo sh -c 'echo vm.swappiness=5 > /etc/sysctl.conf' # Prod Env 
sudo reboot

Some of these packages may already be installed

@larsthegeek
larsthegeek / my-ruby.el
Created March 19, 2016 04:32 — forked from littlemove/my-ruby.el
Spacemacs: Code folding for ruby-mode
;; Code folding
(add-hook 'ruby-mode-hook
(lambda () (hs-minor-mode)))
(eval-after-load "hideshow"
'(add-to-list 'hs-special-modes-alist
`(ruby-mode
,(rx (or "def" "class" "module" "do" "{" "[")) ; Block start
,(rx (or "}" "]" "end")) ; Block end
,(rx (or "#" "=begin")) ; Comment start
# Run this file by placing it in your Rails application's script directory.
# Then you invoke it with:
#
# rails runner script/cards.rb
#
# Or if you are running Zeus:
#
# zeus runner script/cards.rb
require "rubygems"

TL;DR

sudo pg_dropcluster 9.4 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main

Keybase proof

I hereby claim:

  • I am larsthegeek on github.
  • I am larsthegeek (https://keybase.io/larsthegeek) on keybase.
  • I have a public key whose fingerprint is 7752 3710 8DC7 9A73 1580 8171 453B 90B7 CB2F 932C

To claim this, I am signing this object:

# given a model with a postgres array data type called 'wishlist'
# I know I can do
def add_item_to_wishlist(item)
wishlist_will_change!
wishlist = wishlist | item
end
# can I do something like:
def wishlist << (*items)
diff --git a/config/boot.rb b/config/boot.rb
index 69b1a51..2c979cf 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -61,12 +61,30 @@ module Rails
require 'initializer'
end
+ def monkeypatch_helpers
+ require "active_support"
# app/models/email_blacklist_domain.rb
class EmailBlacklistDomain < ActiveRecord::Base
validates :value, presence: true, uniqueness: { case_sensitive: false }
end
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
Check out README.md to get started editing Clojure with Emacs.