I hereby claim:
- I am luctus on github.
- I am theluctus (https://keybase.io/theluctus) on keybase.
- I have a public key ASAOu0tadQXNk5a2f5k6r7t4L0S2O0RdtjfqcKhoBPwH3Qo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# frozen_string_literal: true | |
# Author: Diego Acuña | |
module Liam | |
class Producer | |
def initialize(event, message, options = {}) | |
@event = event | |
@message = message | |
@options = options | |
end |
######################################### | |
# Excercise 1: Words Count | |
Phrase.new("one fish two fish red fish blue fish").count | |
# => {"one"=>1, "fish"=>4, "two"=>1, "red"=>1, "blue"=>1} | |
######################################### | |
# Excercise 2: Acronyms | |
Acronym.call("hello, how are you?") | |
# => "H.H.A.Y" |
Due to our hight traffic we need to be very careful about how we use different cache technics in order to avoid making extra calls to our servers. We also make use of JS to load small pieces of content that should be more fresh than the whole main pages; One example of this is how we load some widgets you can see in our sidebars.
We need to generate the "Most Visited" Widget again, reading the content from this
Every article is identified by a token
(for example 246311
). For every article we have a JSON file that contains
many recommendations for that article, based on 3 different algorithms: logs, content, and myad
- if Rails.env.production? | |
:javascript | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-19488405-8', {'allowAnchor': true}); | |
- else |
class ReportMailer < ApplicationMailer | |
def daily_email(report) | |
@report = report | |
@user = report.user | |
headers["X-SMTPAPI"] = { | |
category: report.category, | |
unique_args: { report: report.id, user: report.user.id } | |
}.to_json |
job_type :exclusive_rake, "cd :path && flock -n 'tmp/pids/cron_:task.lock' -c ':environment_variable=:environment bundle exec rake :task --silent --backtrace :output'" | |
every 1.minute do | |
exclusive_rake "dailytics:run" | |
end |
module ChartStatificator | |
extend ActiveSupport::Concern | |
# need test | |
def generate_static_chart | |
Rails.logger.debug ">>> static_chart for #{id} <<<" | |
data = { | |
'options': {series: chart.series_data, | |
title: chart.options[:title], | |
yAxis: {title: {text: nil}, labels:{}}, |
require "cuba" | |
require "cuba/render" | |
require "tilt/haml" | |
require "sass" | |
require "i18n" | |
require "i18n/backend/fallbacks" | |
Cuba.plugin Cuba::Render | |
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) |