Skip to content

Instantly share code, notes, and snippets.

@tarakanbg
tarakanbg / mail_events.md
Last active March 8, 2017 12:08
Mails transferred to sparkpost
  • N = not transfered, Y = transferred

New order

  • crypto.bg
    • type buy
      • payment bank
      • payment easypay
      • payment CT
      • payment epay
  • clubbtc
@tarakanbg
tarakanbg / sparkpost_variables.md
Last active April 18, 2017 12:19
Sparkpost variables - template substitution data
  • {{slug}} = Trade public id
  • {{trade_type}} = Buy or sell
  • {{rate}} = Trade rate BGN
  • {{rate_eur}} - Rate in EUR
  • {{rate_usd}} - Rate in USD
  • {{crypto_amount}} = Trade BTC amount
  • {{bgn_amount}} = Trade BGN amount minus fees (BTC value based on rate)
  • {{eur_amount}} = Trade EUR amount minus fees (BTC value based on rate)
  • {{usd_amount}} = Trade USD amount minus fees (BTC value based on rate)
  • {{fee}} = Payment provider fees in BGN - epay, bank, easypay fees, etc
require 'open-uri'
require "nokogiri"
released = false
while !released do
page = Nokogiri::HTML(open("http://www.precisionmanuals.com/ProductCart/pc/viewCategories.asp?idCategory=26"))
price = page.css('#pcMain > div > div.pcShowProducts > div:nth-child(1) > div > div.pcShowProductInfoP > div.pcShowProductPrice > span').children.first.text[1..-1].gsub(",", "").to_f
if price < 120
released = true
deployer@disruptive-admin:~/apps/DisruptiveBetsAdmin/current$ bundle exec sidekiq -e production
2014-05-14T16:25:02Z 25100 TID-7otnc INFO: [Sidetiq] Sidetiq v0.5.0 - Copyright (c) 2012-2013, Tobias Svensson <tob@tobiassvensson.co.uk>
2014-05-14T16:25:02Z 25100 TID-7otnc INFO: [Sidetiq] Sidetiq is covered by the 3-clause BSD license.
2014-05-14T16:25:02Z 25100 TID-7otnc INFO: [Sidetiq] See LICENSE and http://opensource.org/licenses/BSD-3-Clause for licensing details.
2014-05-14T16:25:02Z 25100 TID-7otnc INFO: [Sidetiq] Sidetiq::Supervisor start
2014-05-14T16:25:02Z 25100 TID-orx5s7vkk INFO: [Sidetiq] Sidetiq::Actor::Clock id: 69894653755340 initialize
2014-05-14T16:25:02Z 25100 TID-orx4o6nyk INFO: [Sidetiq] Sidetiq::Actor::Handler id: 69894586514180 initialize
2014-05-14T16:25:02Z 25100 TID-orx4o6jks INFO: [Sidetiq] Sidetiq::Actor::Handler id: 69894586508500 initialize
2014-05-14T16:25:02Z 25100 TID-orx5s7vkk WARN: [Sidetiq] Can't link Sidetiq::Actor::Clock. Sidekiq::Manager not running. Retrying in 5 seconds
@tarakanbg
tarakanbg / mail.rb
Created April 30, 2014 13:15
mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "domain.net",
:user_name => "no-reply@domain.net",
:password => "password",
:authentication => "plain",
:enable_starttls_auto => true
}
def self.request_csv
csv = Curl::Easy.http_post("https://cert.vatsim.net/vatsimnet/admin/divdbfullwpilot.php",
Curl::PostField.content('authid', Option.where(:key => "maps_id").first.value),
Curl::PostField.content('authpassword', Option.where(:key => "maps_password").first.value),
Curl::PostField.content('div', Option.where(:key => "maps_division").first.value))
csv.body_str
end

VATEUD API Documentation

by Svilen Vassilev, VATEUD7

Features

  • The API supports json, xml and csv for its data. Use whatever you prefer.
  • It requires no authentication, no API keys, just send a plain GET request and you're served.
  • Be reasonable when polling for changes: the data is only updated once a day anyway.
  • These API calls are served by our EUD server, hence they impose no load or access concerns on the upstream VATSIM databases.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
<a class="__cf_email__" href="http://www.cloudflare.com/email-protection" data-cfemail="6a1d0f08070b191e0f182a0c190405180e030944040f1e">[email&nbsp;protected]</a><script type="text/javascript">
@tarakanbg
tarakanbg / member.rb
Created November 22, 2013 09:37
EUD API new members emails
class Member < ActiveRecord::Base
#.....
has_one :welcome_email
after_create :create_welcome_email
def create_welcome_email
WelcomeEmail.create(member_id: self.id)
end