class Lesson < ApplicationRecord
belongs_to :user
has_many :attachments, dependent: :destroy
accepts_nested_attributes_for :attachments
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
class SiteCheckWorker | |
include Sidekiq::Worker | |
include Sidetiq::Schedulable | |
@@max_retries = 3 | |
@@times_retried = 0 | |
@@timeout_interval = 0.5 | |
recurrence { hourly.minute_of_hour(0,5,10,15,20,25,30,35,40,45,50,55) } | |
def perform | |
get_sites.each do |site| | |
begin |
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
rails g model Pixel ip_address, campaign, content_type, created_at:date ,city, state, user_agent, referral, banner_size |
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 Pixel < ActiveRecord::Base | |
validates_presence_of :ip_address | |
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
# lib/services/locations.rb | |
module Services | |
class Locations | |
require 'net/http' | |
def self.lookup(ip) | |
ip_address = ip | |
url = "http://freegeoip.net/json/#{ip_address}" |
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
# lib/services/params.rb | |
module Services | |
class Params | |
require 'active_support/all' | |
def self.deploy(obj) | |
@url_obj = obj | |
if obj.class == ActionController::Parameters | |
return_new_hash @url_obj |
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
# app/lib/tracker/rack.rb | |
module Tracker | |
class Rack | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
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
rails g model Pixel ip_address, campaign, content_type, created_at:date ,city, state, user_agent, referral, banner_size |
# app/mailers/support_mailer.rb
#
# The Main Support Emailer
#
class SupportMailer < ApplicationMailer
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
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
# aliases | |
alias zshconfig="atom ~/.zshrc" | |
alias ohmyzsh="atom ~/.oh-my-zsh" | |
#reload shell | |
alias reshell="source ~/.zshrc" | |
alias g\?="git status" |
NewerOlder