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
<form action="https://twitter.com/tweet" method="POST" id="sendTweet"> | |
<input type="hidden" name="tweet" value="Hey! Check out my awesome spam site - spam.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
get "/auth/callback" do |env| | |
env.response.headers["Authorization"] = "Bearer token123" # Set the Auth header with JWT. | |
render "src/challenge/views/callback.ecr", "src/challenge/views/layouts/main.ecr" | |
end | |
get "/success" do |env| | |
render "src/challenge/views/success.ecr", "src/challenge/views/layouts/main.ecr" | |
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
require 'redis' | |
require 'rss' | |
URLS = %W{https://news.ycombinator.com/rss | |
http://www.discoverdev.io/rss.xml} | |
redis = Redis.new | |
URLS.each { |url| redis.rpush "feeds_to_fetch", url } |
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
source 'https://rubygems.org' | |
gem 'iron_worker' | |
gem 'feedjira' | |
gem 'mailgun-ruby' |
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
require_relative 'bundle/bundler/setup' | |
require 'iron_worker' | |
require 'feedjira' | |
require 'mailgun' |
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
require 'feedjira' | |
def hn_articles | |
url = "https://news.ycombinator.com/rss" | |
feed = Feedjira::Feed.fetch_and_parse url | |
arts = feed.entries.each do |item| | |
puts "Item: #{item.title}" | |
puts "&& Link: #{item.url}" |
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
def send_email | |
mg_client = Mailgun::Client.new("YOUR-API-KEY") | |
message_params = { | |
from: 'robin@percy.pw', | |
to: IronWorker.payload['email'], | |
subject: 'Your daily developer articles!', | |
text: email_body() | |
} |
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
{ | |
"schedules": [ | |
{ | |
"name": "NightlyNewsletter", | |
"code_name": "USERNAME/newsletter", | |
"start_at": "2018-05-23T01:30:00Z", | |
"timeout": 3600, | |
"run_every": 86400, | |
"payload": { | |
"email": "YOU@YOUREMAIL.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
defp deps do | |
[ | |
{:phoenix, "~> 1.3.2"}, | |
{:phoenix_pubsub, "~> 1.0"}, | |
{:phoenix_ecto, "~> 3.2"}, | |
{:postgrex, ">= 0.0.0"}, | |
{:phoenix_html, "~> 2.10"}, | |
{:phoenix_live_reload, "~> 1.0", only: :dev}, | |
{:gettext, "~> 0.11"}, | |
{:cowboy, "~> 1.0"}, |
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
def application do | |
[ | |
mod: {Imagey.Application, []}, | |
extra_applications: [:logger, :runtime_tools, :ex_aws, :hackney, :poison] | |
] | |
end |