Skip to content

Instantly share code, notes, and snippets.

@mayinx
mayinx / Gemfile
Created November 28, 2013 11:55 — forked from pcreux/Gemfile
Rails + Heroku - Best Practices
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end
In celebration of Whyday: Rubyists always want to show others the beautiful code
they have created, hence the question: Has Anybody Seen My Code?
Has Anybody Seen My Code
(sung to the tune of Has Anybody Seen My Gal)
Clean and small, works for all,
Ruby is my all in all.
Has anybody seen my code?
@mayinx
mayinx / gist:ddc8f7980515eb9834b8
Last active August 29, 2015 14:05 — forked from RaVbaker/gist:2967695
Ubuntu 12.04 Ruby on Rails Development Environment

Ubuntu 12.04 Ruby on Rails Development Environment

I haven't set up an install guide for the latest ubuntu release, largely because the last set of instructions worked pretty closely with the latest and greatest Ubuntu, 12.04 Precise Pangolin, however when installing today, I found that there were enough differences in the way that I configure my setup to justify an update, so here it goes. Yes, I'm late to the party, but a quick google search didn't find anything that I felt was as complete for my requirements as my previous install guides, so here I go.

As always with my install guides, I have included here is just about everything you'll need (and then some) to get started with ruby on rails development with Ubuntu 12.04 as a platform. These are my settings and preferences, and this is certainly not the only way of doing things, so keep that in mind.

Step 1: Get the repos ready and run updates.

sudo apt-get update && sudo apt-get upgrade
@mayinx
mayinx / sublime-text-2-settings-rails-dev.json
Last active August 29, 2015 14:06 — forked from olivierlacan/sublime-text-2-settings.json
Basic Sublime Text 2 settings for Rails development
{
// use customized monokai color scheme (created with the awesome
// tmtheme-editor - see http://tmtheme-editor.herokuapp.com)
"color_scheme": "Packages/User/MonokaiCustomized2.tmTheme",
"ensure_newline_at_eof_on_save": false,
"use_simple_full_screen": false,
// glasses are expensive, protect your eyesight
@mayinx
mayinx / Default (Linux).sublime-keymap
Last active June 30, 2017 14:25
User Key Bindings for Sublime Text 2 - place this in .config/sublime-text-2/Packages/User
[
// inserts / toggles erb tags <%= %> | <% %> | <%- -%> | <%= -%> | <%# %> | <% -%>
{ "keys": ["ctrl+shift+."], "command": "erb" },
// Fold / Unfold Comments
{ "keys": ["ctrl+shift+c"], "command": "toggle_fold_comments" },
// Reindent all Lines
{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": { "single_line": false } },
// layout: show right column full / switch to single column layout
{
"keys": ["alt+right"],
@mayinx
mayinx / filterable.rb
Created August 22, 2016 14:20 — forked from justinweiss/filterable.rb
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with the same name as the keys in <tt>filtering_params</tt>
# with their associated values. Most useful for calling named scopes from
@mayinx
mayinx / main_helper.rb
Created December 1, 2016 10:21 — forked from owen2345/main_helper.rb
Perspective Theme (one click install). Template url: https://p.w3layouts.com/demos/perspective/web/index.html
module Themes::PerspectiveTheme::MainHelper
def self.included(klass)
klass.helper_method [:perspective_social_networks] rescue "" # here your methods accessible from views
end
def perspective_theme_settings(theme)
# callback to save custom values of fields added in my_theme/views/admin/settings.html.erb
end
# callback called after theme installed
@mayinx
mayinx / regex-console.text
Created July 20, 2017 14:45
Remove all console.log from JS in Sublime
Ensure regex button is selected and then type this in the search field.
\s*console\.log(.*);
@mayinx
mayinx / rails_load_path_tips.md
Created October 12, 2017 00:16 — forked from maxim/rails_load_path_tips.md
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/