Name | Deployed | Code |
---|---|---|
Live Tweets in email in Sinatra | Description / Email | Github Gist |
Ruby script for merging CSV files, incl. test suite | - | Github Repo |
Add and vote on best newsletters - (Rails project - TDD) | Heroku | Github Repo |
Yelp clone - (Rails project - TDD) | Heroku | Github Repo |
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
# This code is based on the explanations by Kevin Thompson (http://kevinthompson.info/) here https://gist.github.com/kevinthompson/c3023df8e2c904ad00d9 | |
# See the email here: http://www.mailerbob.com/live-tweets/email.html | |
require 'sinatra' | |
require 'twitter' | |
helpers do | |
def twitter | |
@twitter ||= Twitter::REST::Client.new do |config| | |
config.consumer_key = ENV.fetch("TWITTER_CONSUMER_KEY") |
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
--- | |
layout: default | |
--- | |
<div class="home"> | |
<h1 class="page-heading">Posts in the category [coding]</h1> | |
<ul class="post-list"> | |
{% for post in site.categories.coding %} |
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
{% for category in page.categories %} | |
[<a class="post-meta" href="/{{category}}">{{category}}</a>] | |
{% endfor %} |
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 'minitest/autorun' | |
require_relative 'sieve_of_eratosthenes' | |
class SieveTest < Minitest::Test | |
def test_a_few_primes | |
expected = [2, 3, 5, 7] | |
assert_equal expected, Sieve.new(10).primes | |
end | |
def test_primes |
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 UseVanityController < ActionController::Base | |
class TestModel | |
def test_method | |
Vanity.ab_test(:pie_or_cake) | |
end | |
end | |
attr_accessor :current_user | |
def index |
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 "test_helper" | |
class UseVanityControllerTest < ActionController::TestCase | |
tests UseVanityController | |
def setup | |
super | |
metric :sugar_high | |
new_ab_test :pie_or_cake do | |
metrics :sugar_high |
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 ProofOfWork | |
require 'digest' | |
def initialize(difficulty:) | |
@required_number_of_zeros = difficulty | |
end | |
def find_nonce_for(block_content:) | |
nonce = 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
require 'digest' | |
puts Digest::SHA256.hexdigest("hello world!" + "2030350") |
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 subject_category_interest_props | |
subject_categories = SubjectCategory.in_alphabetical_order | |
interested_subject_categories = current_user.interested_subject_categories | |
{ fields: | |
subject_categories.map do |sc| | |
selected = interested_subject_categories.include?(sc) | |
{ title: sc.title, value: sc.id.to_s, selected: selected } | |
end } | |
end |
OlderNewer