If you've ever looked into how to create Gems, you've probably seen a bunch of ways to do that. Project generators like Hoe, Jeweler, and the like offer some nice ways to get started, but they may often be overkill for many projects. If you're just starting out, why not learn to do it from scratch?
In this talk, we'll create our own gem from scratch, using only things that are provided by Ruby, its standard library, and RubyGems to craft a simple gem.
You'll learn how to set up a project, how to write and run tests, how to use Rake to quickly build the gem, and even how to create a gem that installs an executable command-line program.
Intro talks never let you learn about the things that make a language truly cool. In this talk we'll discover how advanced features of Ruby help us write cleaner more modular code.
Stop Reinventing The Wheel - The Ruby Standard LibraryBrian Hogan
My talk from Ruby Hoedown MMX. We talked about the Ruby standard library and how sometimes we reinvent things when we have perfectly good tools waiting for us to use them.
From zero to almost rails in about a million slides...david_e_worth
A presentation explaining the web with zero background aimed at brand new developers wanting to build Ruby on Rails applications but not knowing where to start
Sooner or later we all have to work with HTML, despite its verbosity. Those of us who claim to love HTML may just be victims of Stockholm Syndrome, both praising yet secretly loathing it.
Basho designer John Newman is making the trek from the swamps of Florida to show us the way. In the modern world of markup preprocessors, these alternative syntaxes allow you to write simpler, cleaner, more concise code in a shorter amount of time. Certain techniques can even allow your team members who may be less-tech-savvy to contribute content directly without forcing you to wire up a WYSIWYG style CMS.
This talk explores great alternatives to plain HTML and CSS, and covers how Basho put these tools together to facilitate a painless, team-oriented approach to building sites and web apps.
Intro talks never let you learn about the things that make a language truly cool. In this talk we'll discover how advanced features of Ruby help us write cleaner more modular code.
Stop Reinventing The Wheel - The Ruby Standard LibraryBrian Hogan
My talk from Ruby Hoedown MMX. We talked about the Ruby standard library and how sometimes we reinvent things when we have perfectly good tools waiting for us to use them.
From zero to almost rails in about a million slides...david_e_worth
A presentation explaining the web with zero background aimed at brand new developers wanting to build Ruby on Rails applications but not knowing where to start
Sooner or later we all have to work with HTML, despite its verbosity. Those of us who claim to love HTML may just be victims of Stockholm Syndrome, both praising yet secretly loathing it.
Basho designer John Newman is making the trek from the swamps of Florida to show us the way. In the modern world of markup preprocessors, these alternative syntaxes allow you to write simpler, cleaner, more concise code in a shorter amount of time. Certain techniques can even allow your team members who may be less-tech-savvy to contribute content directly without forcing you to wire up a WYSIWYG style CMS.
This talk explores great alternatives to plain HTML and CSS, and covers how Basho put these tools together to facilitate a painless, team-oriented approach to building sites and web apps.
Beware the potholes on the road to serverlessYan Cui
Looking in from the outside, serverless seems so simple! And yet, many companies are struggling on their journey to serverless. In this talk, I highlight a number of mistakes companies are making when they adopt serverless.
HTTP/2 can help improve the performance of your site, and is a technology SEOs should have an understanding of. This deck gives you an accessible top level introduction as an SEO.
Many of the recent big data systems, like Hadoop, Spark, and Kafka, are written primarily in JVM languages. At the same time, there is a wealth of tools for data science and data analytics that exist outside of the JVM. Holden Karau and Rachel Warren explore the state of the current big data ecosystem and explain how to best work with it in non-JVM languages. While much of the focus will be on Python + Spark, the talk will also include interesting anecdotes about how these lessons apply to other systems (including Kafka).
Holden and Rachel detail how to bridge the gap using PySpark and discuss other solutions like Kafka Streams as well. They also outline the challenges of pure Python solutions like dask. Holden and Rachel start with the current architecture of PySpark and its evolution. They then turn to the future, covering Arrow-accelerated interchange for Python functions, how to expose Python machine learning models into Spark, and how to use systems like Spark to accelerate training of traditional Python models. They also dive into what other similar systems are doing as well as what the options are for (almost) completely ignoring the JVM in the big data space.
Python users will learn how to more effectively use systems like Spark and understand how the design is changing. JVM developers will gain an understanding of how to Python code from data scientist and Python developers while avoiding the traditional trap of needing to rewrite everything.
Slides from our CodeMash 2013 Precompiler session, "Web Development with Python and Django", including a breezy introduction to the Python programming language and the Django web framework. The example code repository is available at https://github.com/finiteloopsoftware/django-precompiler/
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...Distilled
HTTP/2 and Service Works are becoming more established, yet the SEO community lacks awareness of what they are what they may mean for us. A lot of us know we need to know about them but we manage to keep putting it off. However, for both of these technologies, the next 12 months are going to be the turning point where we really can't avoid learning more about them. Tom will provide and accessible introduction to both, with a focus on what they are, how they work and what SEOs need to know. If you have been scared of jumping in to them until now, this session will help get you up to speed.
A CGI program is any program designed to accept and return data that conforms to the CGI specification. The program could be written in any programming language, including C, Perl, Java, or Visual Basic.
Twig: Friendly Curly Braces Invade Your Templates!Ryan Weaver
Video: http://youtu.be/Jikkiqt-nBo
Twig! Yep, it's that fancy magic that's supposed to make theming in Drupal 8 as much fun as eating beef brisket at Rudy's Country Store in Austin (apologies to my veggie friends!). And in fact, Twig was *born* for this: a language that was created with one job in mind: making writing templates awesome and powerful. Oh, and to make you love using it.
In this talk, we'll learn about Twig from the ground-up: syntax, filters, inheritance and other tricks you can learn now to be ready for Drupal 8. We'll also look at how Twig looks inside Drupal, and how it compares to what you're used to in Drupal 7.
By the end, you'll know everything to start getting your Drupal 8 theme on and be shouting its praises from the hills! Ok, maybe not that last part (but I do love how excited Drupalers get), but you'll definitely have a new friend in your world: Twig.
Beware the potholes on the road to serverlessYan Cui
Looking in from the outside, serverless seems so simple! And yet, many companies are struggling on their journey to serverless. In this talk, I highlight a number of mistakes companies are making when they adopt serverless.
HTTP/2 can help improve the performance of your site, and is a technology SEOs should have an understanding of. This deck gives you an accessible top level introduction as an SEO.
Many of the recent big data systems, like Hadoop, Spark, and Kafka, are written primarily in JVM languages. At the same time, there is a wealth of tools for data science and data analytics that exist outside of the JVM. Holden Karau and Rachel Warren explore the state of the current big data ecosystem and explain how to best work with it in non-JVM languages. While much of the focus will be on Python + Spark, the talk will also include interesting anecdotes about how these lessons apply to other systems (including Kafka).
Holden and Rachel detail how to bridge the gap using PySpark and discuss other solutions like Kafka Streams as well. They also outline the challenges of pure Python solutions like dask. Holden and Rachel start with the current architecture of PySpark and its evolution. They then turn to the future, covering Arrow-accelerated interchange for Python functions, how to expose Python machine learning models into Spark, and how to use systems like Spark to accelerate training of traditional Python models. They also dive into what other similar systems are doing as well as what the options are for (almost) completely ignoring the JVM in the big data space.
Python users will learn how to more effectively use systems like Spark and understand how the design is changing. JVM developers will gain an understanding of how to Python code from data scientist and Python developers while avoiding the traditional trap of needing to rewrite everything.
Slides from our CodeMash 2013 Precompiler session, "Web Development with Python and Django", including a breezy introduction to the Python programming language and the Django web framework. The example code repository is available at https://github.com/finiteloopsoftware/django-precompiler/
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...Distilled
HTTP/2 and Service Works are becoming more established, yet the SEO community lacks awareness of what they are what they may mean for us. A lot of us know we need to know about them but we manage to keep putting it off. However, for both of these technologies, the next 12 months are going to be the turning point where we really can't avoid learning more about them. Tom will provide and accessible introduction to both, with a focus on what they are, how they work and what SEOs need to know. If you have been scared of jumping in to them until now, this session will help get you up to speed.
A CGI program is any program designed to accept and return data that conforms to the CGI specification. The program could be written in any programming language, including C, Perl, Java, or Visual Basic.
Twig: Friendly Curly Braces Invade Your Templates!Ryan Weaver
Video: http://youtu.be/Jikkiqt-nBo
Twig! Yep, it's that fancy magic that's supposed to make theming in Drupal 8 as much fun as eating beef brisket at Rudy's Country Store in Austin (apologies to my veggie friends!). And in fact, Twig was *born* for this: a language that was created with one job in mind: making writing templates awesome and powerful. Oh, and to make you love using it.
In this talk, we'll learn about Twig from the ground-up: syntax, filters, inheritance and other tricks you can learn now to be ready for Drupal 8. We'll also look at how Twig looks inside Drupal, and how it compares to what you're used to in Drupal 7.
By the end, you'll know everything to start getting your Drupal 8 theme on and be shouting its praises from the hills! Ok, maybe not that last part (but I do love how excited Drupalers get), but you'll definitely have a new friend in your world: Twig.
This talk presents an approach to building free network services and introduces Libravatar, a Django-based project to provide a federated and Open Source alternative to the Gravatar profile image hosting service, a centralised web service used by a large number of social sites in the cloud.
2018 the conf put git to work - increase the quality of your rails project...Rodrigo Urubatan
These are the slides I used in my presentation at #theconfbr this year.
If you have any questions or comments about the presentation, contact me through my twitter @urubatan.
if you want to subscribe to my weekly Ruby And Rails tips newsletter please do it in this address http://bit.ly/weekly_rails_tips
Describes Outside-In development and Behvaiour Driven Development. Illustrates basic Cucumber usage within a Rails app and then goes over more advanced topics such as JS as web services.
Creating and Deploying Static Sites with HugoBrian Hogan
Most web sites don’t have data that changes, so why power them with a database and take the performance hit? In this talk we’ll explore static site generation using Hugo, an open-source static site generator. You’ll learn how to make a master layout for all pages, and how to use Markdown to create your content pages quickly.
Then we’ll explore how to deploy the site we made to production. We’ll automate the entire process. When you’re done, you’ll be able to build and deploy static web sites quickly with minimal tooling.
Automating the Cloud with Terraform, and AnsibleBrian Hogan
Need a web server? So did I. But setting everything up by hand is tedious. In this talk, you'll see how to build a load-balanced web server using Ansible, Terraform, and DigitalOcean, a cloud provider aimed at developers. First, you'll see how to build out the servers and load balancer, and then you'll see how to use Ansible Playbooks to install and upload the web site. When we're done, you'll have scripts you can run to set up your own environment.
Create Development and Production Environments with VagrantBrian Hogan
Need a Linux box to test a Wordpress site or a Windows VM to test a web site on IE 10? Creating a virtual machine to test or deploy your software doesn’t have to be a manual process. Bring one up in seconds with Vagrant, software for creating and managing virtual machines. With Vagrant, you can bring up a new virtual machine with the software you need, share directories, copy files, and configure networking using a friendly DSL. You can even use shell scripts or more powerful provisioning tools to set up your software and install your apps. Whether you need a Windows machine for testing an app, or a full-blown production environment for your apps, Vagrant has you covered.
In this talk you’ll learn to script the creation of multiple local virtual machines. Then you’ll use the same strategy to provision production servers in the cloud.
I work with Vagrant, Terraform, Docker, and other provisioning systems daily and am excited to show others how to bring this into their own workflows.
Docker is an amazing tool, but unless you work with it every day, you're probably left with a ton of questions. What's a container? What's an image? What's the difference between Docker, Machine, Compose, and Swarm? Why the heck should I care? Well, Docker makes it easier than ever to deploy and scale your applications and services. In addition, it lets you simulate your production environment on your local machine without heavy virtual machines. In this talk, we'll explore the basics of Docker, create a custom image for a web application, create a group of containers, and look at how you can put your apps into production on various cloud providers. At the end of the talk, you'll have the knowledge you need to put this to use with your own applications.
Come explore Elm, a functional programming language for making web things. Elm aims to solve some of the same problems that Ember, React, and Angular 2 solve, but in a radically different way. Strong and static typing ensures that data you pass around in your apps really is what you think it is. A simple and tried-and-true architecture makes it easy to understand, and great tooling makes it fun to use.
Web Development With Ruby - From Simple To ComplexBrian Hogan
Beyond the massive hype of Ruby on Rails, there's an amazing world of frameworks, DSLs, and libraries that make the Ruby language a compelling choice when working on the web. In this talk, you'll get a chance to see how to use Ruby to quickly build a static web site, create complex stylesheets with ease, build a simple web service, crete a simple Websocket server, and test your existing applications. Finally, you'll see a few of the ways Rails really can make developing complex applications easier, from advanced database querying to rendering views in multiple formats.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
3. The (normal) Process
• Come up with an idea
• write some code
• Release a gem
• Beg people to write tests for you
twitter: bphogan
email: brianhogan at napcs.com
4. Our process
• Come up with an idea and write some code
• Throw all that code away
• Rewrite it with tests as we go
• Release it as a Gem
• Enjoy fame and fortune
twitter: bphogan
email: brianhogan at napcs.com
5. Grabatar
(a gem to grab Gravatar URLs)
http://www.gravatar.com/avatar/
6ef8cb7cd7cd58077f0b57e4fa49a969
twitter: bphogan
email: brianhogan at napcs.com
6. Step one: Build tested,
working code
twitter: bphogan
email: brianhogan at napcs.com
7. The basic structure of a
Gem
gemname.gemspec
lib/
gemname
version.rb
anotherfile.rb
gemname.rb
twitter: bphogan
email: brianhogan at napcs.com
9. Test::Unit
test
somefile_test.rb
twitter: bphogan
email: brianhogan at napcs.com
10. Write the test
test/grabatar_test.rb
require 'test/unit'
require 'lib/grabatar'
class GrabatarTest < Test::Unit::TestCase
def test_displays_version
assert Grabatar::VERSION
end
end
twitter: bphogan
email: brianhogan at napcs.com
11. Implement the code
lib/grabatar/version.rb
module Grabatar
VERSION = "0.0.2"
end
twitter: bphogan
email: brianhogan at napcs.com
12. Add to the main Ruby file:
lib/grabatar.rb
require 'grabatar/version'
twitter: bphogan
email: brianhogan at napcs.com
14. Write the test first...
test/gravatar_helper.rb
require 'test/unit'
require 'grabatar'
class GravatarTest < Test::Unit::TestCase
def test_builds_gravatar_url
g = Grabatar::Gravatar.new("bphogan@gmail.com")
assert_equal "http://www.gravatar.com/avatar/
6ef8cb7cd7cd58077f0b57e4fa49a969", g.avatar_url
end
end
twitter: bphogan
email: brianhogan at napcs.com
15. Then write the code
lib/grabatar/gravatar.rb
module Grabatar
class Gravatar
require 'digest/md5'
def initialize(email)
@email = email
end
def avatar_url
hash = Digest::MD5.hexdigest(@email)
"http://www.gravatar.com/avatar/#{hash}"
end
end
end
twitter: bphogan
email: brianhogan at napcs.com
16. Then write the code
lib/grabatar/gravatar.rb
module Grabatar
class Gravatar
require 'digest/md5'
def initialize(email)
@email = email
end
def avatar_url
hash = Digest::MD5.hexdigest(@email)
"http://www.gravatar.com/avatar/#{hash}"
end
end
end
twitter: bphogan
email: brianhogan at napcs.com
17. Then write the code
lib/grabatar/gravatar.rb
module Grabatar
class Gravatar
require 'digest/md5'
def initialize(email)
@email = email
end
def avatar_url
hash = Digest::MD5.hexdigest(@email)
"http://www.gravatar.com/avatar/#{hash}"
end
end
end
twitter: bphogan
email: brianhogan at napcs.com
18. Then write the code
lib/grabatar/gravatar.rb
module Grabatar
class Gravatar
require 'digest/md5'
def initialize(email)
@email = email
end
def avatar_url
hash = Digest::MD5.hexdigest(@email)
"http://www.gravatar.com/avatar/#{hash}"
end
end
end
twitter: bphogan
email: brianhogan at napcs.com
19. Step two: Make A
Gemspec
twitter: bphogan
email: brianhogan at napcs.com
20. Gemspecs are easy.
grabatar.gemspec
require 'lib/grabatar/version'
Gem::Specification.new do |s|
s.name = "grabatar"
s.version = Grabatar::VERSION
s.summary = "Fetch avatar image URLs from Gravatar"
s.authors = ["Brian Hogan"]
s.email = ["bphogan@gmail.com"]
s.files = [
"lib/grabatar.rb",
"lib/grabatar/version.rb",
"lib/grabatar/gravatar.rb",
"lib/grabatar/railtie.rb",
"lib/grabatar/view_helpers.rb"
]
end
twitter: bphogan
email: brianhogan at napcs.com
21. Gemspecs are easy.
grabatar.gemspec
require 'lib/grabatar/version'
Gem::Specification.new do |s|
s.name = "grabatar"
s.version = Grabatar::VERSION
s.summary = "Fetch avatar image URLs from Gravatar"
s.authors = ["Brian Hogan"]
s.email = ["bphogan@gmail.com"]
s.files = [
"lib/grabatar.rb",
"lib/grabatar/version.rb",
"lib/grabatar/gravatar.rb",
"lib/grabatar/railtie.rb",
"lib/grabatar/view_helpers.rb"
]
end
twitter: bphogan
email: brianhogan at napcs.com
22. Gemspecs are easy.
grabatar.gemspec
require 'lib/grabatar/version'
Gem::Specification.new do |s|
s.name = "grabatar"
s.version = Grabatar::VERSION
s.summary = "Fetch avatar image URLs from Gravatar"
s.authors = ["Brian Hogan"]
s.email = ["bphogan@gmail.com"]
s.files = [
"lib/grabatar.rb",
"lib/grabatar/version.rb",
"lib/grabatar/gravatar.rb",
"lib/grabatar/railtie.rb",
"lib/grabatar/view_helpers.rb"
]
end
twitter: bphogan
email: brianhogan at napcs.com
23. Gemspecs are easy.
grabatar.gemspec
require 'lib/grabatar/version'
Gem::Specification.new do |s|
s.name = "grabatar"
s.version = Grabatar::VERSION
s.summary = "Fetch avatar image URLs from Gravatar"
s.authors = ["Brian Hogan"]
s.email = ["bphogan@gmail.com"]
s.files = [
"lib/grabatar.rb",
"lib/grabatar/version.rb",
"lib/grabatar/gravatar.rb",
"lib/grabatar/railtie.rb",
"lib/grabatar/view_helpers.rb"
]
end
twitter: bphogan
email: brianhogan at napcs.com
30. Test first
test/view_helpers_test.rb
require 'test/unit'
require 'grabatar/gravatar'
require 'grabatar/view_helpers'
class ViewHelpers < Test::Unit::TestCase
include Grabatar::ViewHelpers
def test_generates_avatar_url
assert_equal
"http://www.gravatar.com/avatar
/6ef8cb7cd7cd58077f0b57e4fa49a969",
gravatar_url_for("bphogan@gmail.com")
end
end
twitter: bphogan
email: brianhogan at napcs.com
31. Test first
test/view_helpers_test.rb
require 'test/unit'
require 'grabatar/gravatar'
require 'grabatar/view_helpers'
class ViewHelpers < Test::Unit::TestCase
include Grabatar::ViewHelpers
def test_generates_avatar_url
assert_equal
"http://www.gravatar.com/avatar
/6ef8cb7cd7cd58077f0b57e4fa49a969",
gravatar_url_for("bphogan@gmail.com")
end
end
twitter: bphogan
email: brianhogan at napcs.com
32. Create a helper
lib/grabatar/view_helpers.rb
module Grabatar
module ViewHelpers
def gravatar_url_for(email)
Grabatar::Gravatar.new(email).avatar_url
end
end
end
twitter: bphogan
email: brianhogan at napcs.com
34. Include the Helper
lib/grabatar/railtie.rb
module Grabatar
class Railtie < Rails::Railtie
initializer "grabatar.view_helpers" do
ActionView::Base.send :include, ViewHelpers
end
end
end
twitter: bphogan
email: brianhogan at napcs.com
35. Only load the Railtie if we have Rails
lib/grabatar.rb
require 'grabatar/railtie' if defined?(Rails)
twitter: bphogan
email: brianhogan at napcs.com
36. Making a CLI tool
twitter: bphogan
email: brianhogan at napcs.com
37. Add a bin folder with
the file!
twitter: bphogan
email: brianhogan at napcs.com
38. The CLI program
bin/grabatar
#!/usr/bin/env ruby
require 'grabatar'
puts "Grabatar v#{Grabatar::VERSION}"
email = ARGV[0]
if email.nil?
puts "Usage: grabatar <youremail@server.com>"
else
g = Grabatar::Gravatar.new(email)
puts g.avatar_url
end
twitter: bphogan
email: brianhogan at napcs.com
39. The CLI program
bin/grabatar
#!/usr/bin/env ruby
require 'grabatar'
puts "Grabatar v#{Grabatar::VERSION}"
email = ARGV[0]
if email.nil?
puts "Usage: grabatar <youremail@server.com>"
else
g = Grabatar::Gravatar.new(email)
puts g.avatar_url
end
twitter: bphogan
email: brianhogan at napcs.com
40. The CLI program
bin/grabatar
#!/usr/bin/env ruby
require 'grabatar'
puts "Grabatar v#{Grabatar::VERSION}"
email = ARGV[0]
if email.nil?
puts "Usage: grabatar <youremail@server.com>"
else
g = Grabatar::Gravatar.new(email)
puts g.avatar_url
end
twitter: bphogan
email: brianhogan at napcs.com
41. Running it
$ grabatar bphogan@gmail.com
Grabatar v0.0.2
http://www.gravatar.com/avatar/6ef8cb7cd7cd58077f0b57e4fa49a969
twitter: bphogan
email: brianhogan at napcs.com
42. Who wants code?
http://github.com/napcs/grabatar
twitter: bphogan
email: brianhogan at napcs.com
43. Thanks!
http://spkr8.com/t/8181
twitter: bphogan
email: brianhogan at napcs.com
Editor's Notes
\n
Who here knows what a Gem is? Who's built a gem?\n
\n
\n
Simple gem that fetches the Gravatar URL based on the given email\n
This is the easy part.\n
a lib folder, a "main" file that includes our other files\n
Because they make for good code.\n
Because it's there. I think Gems should try to have as few dependencies as possible.\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
By hand. \n
\n
\n
\n
Lists all the files you wish to release with your Gem.\n
It sure is handy, but its generated manifest is overkill. It depends on git. Maybe it&#x2019;s not bad for you, but it sure makes me uncomfortable. It also requires that I use Git. I can remove these lines trivially. But it&#x2019;s still uncomfortable.\n
Things that automatically build manifests can (and do) accidentally include things like this, and more. And you can't put exceptions in for every possible type of IDE backup file or hidden folder a contributor might have.\n
This way, you ensure that what's in the Gem is what you want, and what your contributors want. \n
\n
We can make our gems work with Rails. Let's make a really simple Rails helper\n
Our helper will be a module, so we write a test that includes the module and tests that it returns the right result.\n
Our helper will be a module, so we write a test that includes the module and tests that it returns the right result.\n
\n
We create a new class that inherits from Railtie and then mix our module into the view helpers\n