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

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.
(defn optify
"Helper that examines paths with the supplied prefix and either subs
in their cache-busting URLs or returns them unchanged."
[req prefix]
(fn [^String src]
(or (and (.startsWith src prefix)
(not-empty (link/file-path req src)))
src)))

Eliminating Code Smell With Grunt

Gvn Lazar Suntop @gvn

Intro

I love clean code. There, I said it. I pride myself on passing strict linting standards and keeping my code easy to read. It's not just a personal proclivity, but a choice I hope benefits other developers.

My general experience with teams has been that code style is something people care about and have strong personal preferences. Typically, at some point people get tired of dealing with inconsistency and a standardization meeting is called. This is, of course, an important discussion to have. The problem that tends to occur is either lack of documentation or lack of enforcement of the agreed upon style. Additionally, new team members or contributors may not have access to a clear set of rules.

Beyond the challenge of defining rules lies the supreme annoyance of enforcing them. Code reviews become cluttered with nits to be picked. Time is wasted. The solution I settled on was simply automating the conformanc