This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Customers::GridCountsController < ApplicationController | |
def index | |
render json: GridCountsQuery.run(params[:grid_counts]) | |
end | |
end | |
class GridCountsQuery | |
class << self | |
def run | |
query.each_with_object(Hash.new) do |row, grid| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Profile < ActiveModel::Aggregator | |
aggregate :user | |
aggregate :email | |
def combine | |
user.save | |
user.emails.build(email_attributes).save | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original Rails controller and action | |
class EmployeesController < ApplicationController | |
def create | |
@employee = Employee.new(employee_params) | |
if @employee.save | |
redirect_to @employee, notice: "Employee #{@employee.name} created" | |
else | |
render :new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module YourApp | |
class Application < Rails::Application | |
# Convenience for loading config/foo.yml for the current Rails env. | |
# | |
# Example: | |
# | |
# config/cleversafe.yml: | |
# | |
# production: | |
# url: http://127.0.0.1:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Channel | |
class CommentsChannel < ApplicationCable::Channel | |
def self.broadcast_comment(comment) | |
broadcast_to comment.message, comment: CommentsController.render( | |
partial: 'comments/comment', locals: { comment: comment } | |
) | |
end | |
def follow(data) | |
stop_all_streams |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, | |
This is Neela, recruiter from Kellton Tech Solutions (Formerly Prosoft Technology Group, Inc) | |
We are an Information Technology and Business Consulting firm specializing in Project-based Solutions | |
and Professional Staffing Services. I just tried reaching you today as your profile has been one of | |
the best matches for an immediate job opportunity I have with my client. So, please have a look at | |
the job description and let me know your interest ASAP. I would really appreciate if you could send | |
me your most updated resume also. | |
Please Note: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Requires that you have ./bin/dcpTool from https://sourceforge.net/projects/dcptool/ | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'nokogiri' | |
input_camera_model = ARGV[0] || "LEICA Q (Typ 116)" | |
output_camera_model = ARGV[1] || "LEICA M10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// Results from MacBook (Retina, 12-inch, Early 2016), 1.3 GHz Intel Core m7, macOS 10.12.3, Node 7.6.0 | |
// let a = { z: 1 } | |
// human-friendly x 85,821,153 ops/sec ±1.81% (87 runs sampled) | |
// machine-friendly x 92,613,579 ops/sec ±1.89% (85 runs sampled) | |
// Fastest is machine-friendly | |
// let a = undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Entry::TrackerBlocking | |
extend ActiveSupport::Concern | |
included do | |
has_many :blocked_trackers | |
end | |
email_service_blockers = { | |
"ActiveCampaign" => /lt\.php(.*)?l\=open/, | |
"AWeber" => "openrate.aweber.com", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |