Skip to content

Instantly share code, notes, and snippets.

@dgtm
dgtm / gist:3982074
Created October 30, 2012 18:28
Board Sketch
class Board
#properties
attr_accessor :location
attr_accessor :width
attr_accessor :height
attr_accessor :name
#relationships
attr_accessor :image
attr_accessor :contract
@dgtm
dgtm / gist:4130055
Created November 22, 2012 08:50
Phase I
HTMLHelper
<repl type="ruby">
<code file="timer" operation="append/create">
require 'lib/clock.rb'
class Timer
def tick
Clock.new.rewind
end
end
</code>
@dgtm
dgtm / gist:4983553
Last active December 13, 2015 22:19
class SheetWorker
include Sidekiq::Worker
sidekiq_options queue: :critical, :retry => 3
def perform(id)
sheet = Sheet.find(id)
if sheet.failed?
sheet.resend_failed_sheet
end
begin
Muddling with Modules
Goals:
How do most of us use modules?
How do we change the way we use modules?
Topics:
Including/Extending
Namespacing
Mixing In
@dgtm
dgtm / gist:5617866
Created May 21, 2013 06:29
hello test
this is my first test with gist...
@dgtm
dgtm / Alert Ignition
Last active August 29, 2015 14:06
Alert Ignition
# !/usr/local/bin/ruby
require 'rubygems'
require 'json'
require 'httparty'
# Change modem_id at your will
modem = "MO-2"
lat = -119.7579390625
lon = 36.1208411143
# Change the seconds value (24 here) every time you run this
Tooltip = (a) ->
@setValues a
b = @div_ = document.createElement("div")
b.style.position = "absolute"
b.style.zIndex = "999"
b.className = "tooltip"
@draw = ->
@add_ = add_
@remove_ = remove_
{"0010X000045gSQqQAM"=>["4594596", "4594714", "4594748"],
"0010X000045h8B7QAI"=>["166075", "4640870"],
"0010X000045hMwCQAU"=>["4662181", "5039844"],
"0010X000045i3aBQAQ"=>["4706822", "4927195"],
"0010X000045iOABQA2"=>["4733508", "4875215"],
"0010X000047d1TqQAI"=>["4776025", "4880288"],
"0010X000047dGaEQAU"=>["4801072", "4913834"],
"0010X000047egzDQAQ"=>["4873664", "5207189"],
"0010X000047erU6QAI"=>["4882589", "5155944"],
"0010X000047eY8bQAE"=>["4862993", "5000751"],
["4594714", "4594748", "4640870", "5039844", "4927195", "4875215", "4880288", "4913834", "5207189", "5155944", "5000751", "5104034", "5355968", "4937012", "4936981", "5054076", "5425321", "5088219", "5011313", "5029527", "5040905", "5192641", "5157289", "5158951", "5327093", "5399195", "5273665", "5254688", "5259247", "5407348", "5252338", "5318855", "5459002", "5398973", "5336686", "5337263", "5348984", "5361228", "5383595", "5401848", "5422157", "5436597", "5475904", "8091", "45049", "847755", "2674468", "8757", "13984", "3415236", "4003229", "9028", "33501", "57337", "9224", "11582", "2806973", "612297", "13615", "10961", "3779741", "21506", "82642", "16374", "10189", "15424", "14347", "14461", "2590786", "3619008", "335899", "31426", "10014", "10805", "10039", "10101", "11790", "1499017", "11261", "56702", "464713", "570213", "1405286", "16874", "4163794", "12215", "4280118", "41889", "15585", "12452", "35914", "12089", "3213040", "2754106", "12474", "12267", "12431", "261793", "851021", "13639", "12682",
class LocalCampaign
attr_accessor :id, :job_id, :status, :external_reference, :ad_description, :discrepancies
def self.remote_mappings
{
external_reference: :external_reference,
ad_description: :ad_description
}
end
def eql?(remote_campaign)