Skip to content

Instantly share code, notes, and snippets.

View joseph-ravenwolfe's full-sized avatar
🚀

Joseph Ravenwolfe joseph-ravenwolfe

🚀
View GitHub Profile
fontName = "Monaco"
fontSize = 19
tabSize = 2
softTabs = true
softWrap = false
exclude = "{$exclude,*.tmproj,*.log}"
excludeInFolderSearch = "{$excludeInFolderSearch,db/migrate,log,doc}"
# Remove .sh from the filename
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%}*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
# Customized git status, oh-my-zsh currently does not
# allow render dirty status before branch
git_custom_status() {
# What we are going to do is retrieve all of the users.
#
# Then loop through all of the users. For each user that
# we loop through, we will get all of their clients.
#
# Then we will loop through each of that user's clients
# and send that client an email.
#
# We will send the client object into daily_email and
# let daily_mail get whatever information it needs
@joseph-ravenwolfe
joseph-ravenwolfe / html_safe_i18n_exception_handler.rb
Created December 4, 2013 21:15
Reflective i18n XSS Vulnerability Patch
# config/initializers/html_safe_i18n_exception_handler.rb
require 'i18n'
# Override exception handler to more carefully html-escape missing-key results.
class HtmlSafeI18nExceptionHandler
Missing = I18n.const_defined?(:MissingTranslation) ? I18n::MissingTranslation : I18n::MissingTranslationData
def initialize(original_exception_handler)
@original_exception_handler = original_exception_handler
@joseph-ravenwolfe
joseph-ravenwolfe / action_view_header_caching_handler.rb
Created December 4, 2013 21:28
Rails DDOS Vulnerability Patch
# config/initializers/action_view_header_caching_handler.rb
ActiveSupport.on_load(:action_view) do
ActionView::LookupContext::DetailsKey.class_eval do
class << self
alias :old_get :get
def get(details)
if details[:formats]
details = details.dup
@joseph-ravenwolfe
joseph-ravenwolfe / 20131208171336_create_roles.rb
Last active December 30, 2015 17:59
Adding Dynamic Roles to Users
# db/migrate/20131208171336_create_roles.rb
class CreateRoles < ActiveRecord::Migration
def change
create_table :roles do |t|
t.string :name
t.timestamps
end
end
end
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""" SYSTEM """"""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " DO NOT USE VI
set rtp+=~/.vim/bundle/vundle/ " SET VUNDLER PATH
call vundle#rc() " USE VUNDLER
set shell=/bin/bash " FIX RVM
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""" GITHUB BUNDLES """"""""""""""""""""""""""""""""
def performance
stores = {1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0}
stores.keys.each do |store_number|
print "Please enter the amount for store #{store_number}: "
stores[store_number] = (gets.chomp.to_i / 100).floor
end
puts "Sales Bar Chart"
@joseph-ravenwolfe
joseph-ravenwolfe / request.md
Created November 11, 2015 22:40 — forked from nilbus/request.md
Proposed changes to tcrayford/Values

This gem is great. Thanks for releasing it!

We're running into 2 issues using Values, however.

  1. Inheritance from other classes is impossible
  2. No support for optional arguments to ValueClass.with

What I'm suggesting is a significant deviation from current usage and would require a major version release. That said, I think the benefits are worth it. Please review these ideas, and let me know if you would consider accepting future Pull Requests for these changes into the project, providing that the changes are simple and elegant enough to stay in line with the project's goal for simplicity. If not, we'll fork and release under a different name.

Inheritance

Pattern 1

# Bad
class Person
  def be_polite(big_favor)
    if big_favor
      'Thank you very much'
    else
      'Thank you'