Skip to content

Instantly share code, notes, and snippets.

View maletor's full-sized avatar

Ellis Berner maletor

View GitHub Profile
require 'rubygems'
specs_with_extensions = Gem::Specification.each.select { |spec| spec.extensions.any? }
specs_with_extensions.each do |spec|
puts "#{spec.name} (extensions: #{spec.extensions.inspect})"
end
@maletor
maletor / default.rb
Created February 9, 2012 10:23 — forked from stigkj/default.rb
A simple Chef recipe to install Jenkins
#
# Cookbook Name:: jenkins
# Recipe:: default
#
# https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
# This is super-simple, compared to the other Chef cookbook I found
# for Jenkins (https://github.com/fnichol/chef-jenkins).
#
# This doesn't include Chef libraries for adding Jenkin's jobs via
@maletor
maletor / app.js
Created July 23, 2012 07:09
Bootstrap data using RequireJS and Backbone
require(['userAttributes', 'backbone', 'user_router'], function (config, Backbone, UserRouter) {
var userRouter = new UserRouter() {
userAttributes: userAttributes
};
return router;
});
diff --git a/app/models/inbox/recruiter_message.rb b/app/models/inbox/recruiter_message.rb
index 2373ae2..c1b7eab 100644
--- a/app/models/inbox/recruiter_message.rb
+++ b/app/models/inbox/recruiter_message.rb
@@ -20,6 +20,8 @@ class Inbox::RecruiterMessage < Inbox::Message
validate :available_credits, on: :create
validate :active_subscription, on: :create
+ after_create :doc_mail_debit
+
rds-modify-db-parameter-group dox-prod-55 \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value=4563402752, method=pending-reboot" \
--parameters="name=max_heap_table_size, value=4563402752, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value=2281701376, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value=1140850688, method=pending-reboot" \
--parameters="name=thread_cache_size, value=5803, method=pending-reboot" \
groups = Rails.groups(assets: %w(development test))
groups << ENV["GITHUB_USER"] unless user.blank? unless Rails.env.production?
Bundler.require(*groups)
@maletor
maletor / content-for-group.js
Created May 3, 2016 05:46 — forked from mrozema/content-for-group.js
Ember 2.0 compatible select box
import Ember from "ember";
export default Ember.Helper.helper(function([content, group, contentGroupKey]) {
return content.filterBy(contentGroupKey, group);
});
@maletor
maletor / enum_perf_small.rb
Last active June 7, 2018 23:08 — forked from taq/enum_perf_small.rb
Ruby 2.0 lazy enumerators small collection performance
require "benchmark"
include Benchmark
values = (0..10_000_000).to_a
bm(1_000_000) do |bench|
bench.report("map and select") do
values.map { |x| x * 3 }.select { |x| x % 4 == 0 }
end
bench.report("inject") do
@maletor
maletor / img_convert.rb
Created October 3, 2011 22:24 — forked from arirusso/img_convert.rb
convert html img tags to rails image_tag calls
#!/usr/bin/env ruby
require "nokogiri"
# opens every file in the given dir tree and converts any html img tags to rails image_tag calls
#
# example usage:
# ruby convert.rb ~/my_rails_app/app/views
#
# ***be careful and backup before using this***
#
@maletor
maletor / Ruby and Rails Interview Cheat Sheet.md
Created March 21, 2017 17:32 — forked from ahmadhasankhan/Ruby and Rails Interview Cheat Sheet.md
This is my Ruby interview cheat sheet. Feel free to fork it, Use it, Share it, or do whatever you want with it. PLEASE let me know if there is any error or if anything crucial is missing. I will keep updating...

Ruby and Rails Interview Questions

Ruby

  • What is a class?
  • What is an object?
  • What is a module? Can you tell me the difference between classes and modules?
  • Can you tell me the three levels of method access control for classes and modules? What do they imply about the method?
  • There are three ways to invoke a method in ruby. Can you give me at least two?
  • Explain this ruby idiom: a ||= b