SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
From Ruby Installation
                         to Deploy
                            this is gonna hurt your head




Tuesday, October 19, 2010
About Me

                            Speaker.new({
                               :name        =>   "Scotty Motte",
                               :email       =>   "scott@spitfiresky.com",
                               :twitter     =>   "@spitfiresky",
                               :works_on    =>   "http://smartevents.com"
                            })




Tuesday, October 19, 2010
Building Web Apps
                    • Server Side
                            •   Server Side Programming Language - Ruby

                            •   Database - MySQL

                            •   Versioning Software - GIT


                    • Browser Side
                            •   HTML - HAML

                            •   Javascript - jQuery

                            •   AJAX




Tuesday, October 19, 2010
Server Side




Tuesday, October 19, 2010
Programming Languages
                    •       Ruby (writes like english. great community. hotter than
                            your mom. nuff said.)

                    • PHPbrackets)like someone shat all over the page with
                      curly
                            (looks


                    • Java (configuration weirdos)
                    • .NET (put a gun to my head already)
                    • Perl (WTF)
Tuesday, October 19, 2010
Why Ruby
                    • Created by Matz - he’s Japanese
                    • Programmer Happiness! - written for
                            humans not for computers
                    • Easy to read and write
                            5.times { puts "Have some chunky bacon Matz."}

                            ['riverside', 'japan', 'america'].each {|locale|
                            puts locale.capitalize }


                    • Popularized by Ruby on Rails
Tuesday, October 19, 2010
Install Ruby
                    • Mac Users, I say rejoice, for thou haveth
                            Ruby already!
                    • Windows users - are you prejudiced
                             towards Japan or something?! Let’s fix that
                             by installing Ruby:
                            • http://www.ruby-lang.org/en/downloads/ - run the one-click installer
                                and make sure to de-check the SciTE and check enable ruby gems.
                                Important.

                            •   (http://docs.heroku.com/windows) - very helpful. video.


                                                 Remember - friends don’t let friends use internet explorer.
Tuesday, October 19, 2010
Database

                    • Where we store our data
                    • MySQL popular
                    • skip


Tuesday, October 19, 2010
Git
                    • Keeps track of all the code you write
                    • http://code.google.com/p/msysgit/
                            (windows)
                    • http://code.google.com/p/git-osx-installer/
                            (mac)
                    • http://github.com (keep your code safe)

Tuesday, October 19, 2010
Hello World app

                    • [sudo] gem install sinatra
                    • [sudo] gem install unicorn
                    • [sudo] gem install haml
                    • mkdir hello_world
                    • cd hello_world

Tuesday, October 19, 2010
Hello World app cont.
                    • Create and edit app.rb
                              require 'rubygems'
                              require 'sinatra'

                              get '/' do
                                "Hello World!"
                              end




Tuesday, October 19, 2010
Hello World app cont.
                    • Create and edit config.ru file
                             require 'app'
                             run Sinatra::Application




Tuesday, October 19, 2010
Hello World app cont.
                    • Create and edit .gems file for heroku

                            sinatra --version '>= 0.9.4'
                            haml




Tuesday, October 19, 2010
Hello World app cont.

                    • Run the local server: unicorn -p 3000
                    • Browse to: http://localhost:3000/
                    • Congrats! Drink a beer!


Tuesday, October 19, 2010
Deploy


                    • Sign up on Heroku: http://heroku.com
                    • [sudo] gem install heroku


Tuesday, October 19, 2010
Deploy cont.

                    • cd into your hello_world project
                    • git init
                    • git add .
                    • git commit -am “initial import”

Tuesday, October 19, 2010
Deploy cont.


                    • ssh-keygen -C “you@email.com” -t rsa
                    • (leave the passphrase blank unless it’s your
                            computer)




Tuesday, October 19, 2010
Deploy cont.

                    • heroku create
                    • git push heroku master
                    • heroku rename yourchoice
                    • browse to http://yourchoice.heroku.com

Tuesday, October 19, 2010
Deploy cont.
                    • Other things you can do
                       • Add an about page
                       • Switch to haml
                       • Add a layout file
                       • Add images under a public folder
                       • Move onto ajax
Tuesday, October 19, 2010
views/layout.haml
                    !!!
                    %html
                      %head
                        %title Your App
                        %link{:rel=>'stylesheet', :href=>'/stylesheets/
                    layout.css', :type => "text/css"}
                        / javascripts
                        %script{:type => "text/javascript", :src => "/javascripts/
                    jquery.js"}
                        %script{:type => "text/javascript", :src => "/javascripts/
                    index.js"}
                      %body
                        = yield




Tuesday, October 19, 2010
views/index.haml
                               %h1
                                 Hello World!




                                get '/' do
                                  haml :index
                                end




Tuesday, October 19, 2010
Browser Side




Tuesday, October 19, 2010
public/javascripts


                    • Add jquery.js - download from jquery.com
                    • Add index.js


Tuesday, October 19, 2010
public/javascripts/
                                 index.js

                            $(document).ready(function() {
                              alert("It works!");
                            });




Tuesday, October 19, 2010
views/index.haml
             %h1 Hello World

             %h2 Search

             %form{:id => "search_form", :method => "get", :action => "/search"}
               %input{:type => "text", :id => "search_field", :name => "search_field"}
               %input{:type => "submit", :value => "Search", :id => "search_btn"}

             %ul#search_field_value
               %li= @search_field_value




Tuesday, October 19, 2010
app.rb (add route)
                            get '/search' do
                              @search_field_value = params[:search_field]
                              haml :index
                            end




Tuesday, October 19, 2010
public/javascripts/
                                   index.js
                            $(document).ready(function() {
                              $("#search_btn").click(function() {
                                var search_text = $("#search_field").val();
                                alert(search_text);
                                return false;
                              });
                            });




Tuesday, October 19, 2010
public/javascripts/
                                 index.js
                            $(document).ready(function() {
                              $("#search_btn").click(function() {
                                var search_text = $("#search_field").val();
                                // alert(search_text);

                                $.ajax({
                                  url: "/search?search_field="+search_text,
                                  success: function(responseText, statusText, xhr) {
                                     $('#search_field_value').append(responseText);
                                  },
                                  error: function(request, statusText, xhr) {
                                     alert("There was an error!");
                                  }
                                });

                                return false;
                              });
                            });




Tuesday, October 19, 2010
public/javascripts/
                                  index.js
                            get '/search' do
                              @search_field_value = params[:search_field]
                              "<li>#{@search_field_value}</li>"
                            end




Tuesday, October 19, 2010
The End




Tuesday, October 19, 2010

Contenu connexe

En vedette (8)

Romans 8 2 mms 11 13 and 20 22011
Romans 8 2 mms  11 13 and 20 22011Romans 8 2 mms  11 13 and 20 22011
Romans 8 2 mms 11 13 and 20 22011
 
Map It! 090717
Map It! 090717Map It! 090717
Map It! 090717
 
Epwp E Londen 17 June2008
Epwp E Londen 17 June2008Epwp E Londen 17 June2008
Epwp E Londen 17 June2008
 
Rubattino Portfolio
Rubattino PortfolioRubattino Portfolio
Rubattino Portfolio
 
Kon nichi wa_ruby
Kon nichi wa_rubyKon nichi wa_ruby
Kon nichi wa_ruby
 
Luke 1 1 4 42.3 mms 03 06 2012 jesus in the old testment
Luke 1 1 4 42.3   mms 03 06 2012 jesus in the old testmentLuke 1 1 4 42.3   mms 03 06 2012 jesus in the old testment
Luke 1 1 4 42.3 mms 03 06 2012 jesus in the old testment
 
Philippians 3 outline now
Philippians  3 outline nowPhilippians  3 outline now
Philippians 3 outline now
 
Belajar cara belajar
Belajar cara belajarBelajar cara belajar
Belajar cara belajar
 

Similaire à Presentation to wdim_students

Dojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup ChicagoDojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup Chicagowolframkriesing
 
通用JS时代的模块机制和编译工具
通用JS时代的模块机制和编译工具通用JS时代的模块机制和编译工具
通用JS时代的模块机制和编译工具Dexter Yang
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGuillaume Laforge
 
Codemotion 2013 - presentación cocoa pods
Codemotion  2013 -  presentación cocoa podsCodemotion  2013 -  presentación cocoa pods
Codemotion 2013 - presentación cocoa podsJorge Maroto
 
Casual and Social Games with Unity
Casual and Social Games with UnityCasual and Social Games with Unity
Casual and Social Games with UnityTadej Gregorcic
 
Tomboy Web Sync Explained
Tomboy Web Sync ExplainedTomboy Web Sync Explained
Tomboy Web Sync ExplainedMohan Krishnan
 
iBizLog. Smalltalking the Web
iBizLog. Smalltalking the WebiBizLog. Smalltalking the Web
iBizLog. Smalltalking the WebESUG
 
Leweb09 Building Wave Robots
Leweb09 Building Wave RobotsLeweb09 Building Wave Robots
Leweb09 Building Wave RobotsPatrick Chanezon
 
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -Kei Shiratsuchi
 
Dockerizing IoT Services
Dockerizing IoT ServicesDockerizing IoT Services
Dockerizing IoT Servicesmsyukor
 
Ruby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source CommunityRuby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source CommunityJim Myhrberg
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Murat Yener
 
Compiling and Optimizing Your Own Browser with WebKit
Compiling and Optimizing Your Own Browser with WebKitCompiling and Optimizing Your Own Browser with WebKit
Compiling and Optimizing Your Own Browser with WebKitSencha
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium IntroNicholas Jansma
 
UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projectspchristensen
 
GOTO Paris | @see Gopher
GOTO Paris | @see GopherGOTO Paris | @see Gopher
GOTO Paris | @see GopherJan Klat
 

Similaire à Presentation to wdim_students (20)

Dojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup ChicagoDojo Basics Js UserGroup Chicago
Dojo Basics Js UserGroup Chicago
 
Html5 Apps
Html5 AppsHtml5 Apps
Html5 Apps
 
通用JS时代的模块机制和编译工具
通用JS时代的模块机制和编译工具通用JS时代的模块机制和编译工具
通用JS时代的模块机制和编译工具
 
Processing
ProcessingProcessing
Processing
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
 
Codemotion 2013 - presentación cocoa pods
Codemotion  2013 -  presentación cocoa podsCodemotion  2013 -  presentación cocoa pods
Codemotion 2013 - presentación cocoa pods
 
Casual and Social Games with Unity
Casual and Social Games with UnityCasual and Social Games with Unity
Casual and Social Games with Unity
 
Tomboy Web Sync Explained
Tomboy Web Sync ExplainedTomboy Web Sync Explained
Tomboy Web Sync Explained
 
Node and SocketIO
Node and SocketIONode and SocketIO
Node and SocketIO
 
iBizLog. Smalltalking the Web
iBizLog. Smalltalking the WebiBizLog. Smalltalking the Web
iBizLog. Smalltalking the Web
 
Vagrant at LA Ruby
Vagrant at LA RubyVagrant at LA Ruby
Vagrant at LA Ruby
 
Leweb09 Building Wave Robots
Leweb09 Building Wave RobotsLeweb09 Building Wave Robots
Leweb09 Building Wave Robots
 
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
或るWebサービス開発のこれから - "オープンWebサービス"という妄想 -
 
Dockerizing IoT Services
Dockerizing IoT ServicesDockerizing IoT Services
Dockerizing IoT Services
 
Ruby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source CommunityRuby, Rails, and the Open Source Community
Ruby, Rails, and the Open Source Community
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
 
Compiling and Optimizing Your Own Browser with WebKit
Compiling and Optimizing Your Own Browser with WebKitCompiling and Optimizing Your Own Browser with WebKit
Compiling and Optimizing Your Own Browser with WebKit
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
 
UI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware ProjectsUI Beyond the Browser - Software for Hardware Projects
UI Beyond the Browser - Software for Hardware Projects
 
GOTO Paris | @see Gopher
GOTO Paris | @see GopherGOTO Paris | @see Gopher
GOTO Paris | @see Gopher
 

Dernier

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Presentation to wdim_students

  • 1. From Ruby Installation to Deploy this is gonna hurt your head Tuesday, October 19, 2010
  • 2. About Me Speaker.new({ :name => "Scotty Motte", :email => "scott@spitfiresky.com", :twitter => "@spitfiresky", :works_on => "http://smartevents.com" }) Tuesday, October 19, 2010
  • 3. Building Web Apps • Server Side • Server Side Programming Language - Ruby • Database - MySQL • Versioning Software - GIT • Browser Side • HTML - HAML • Javascript - jQuery • AJAX Tuesday, October 19, 2010
  • 5. Programming Languages • Ruby (writes like english. great community. hotter than your mom. nuff said.) • PHPbrackets)like someone shat all over the page with curly (looks • Java (configuration weirdos) • .NET (put a gun to my head already) • Perl (WTF) Tuesday, October 19, 2010
  • 6. Why Ruby • Created by Matz - he’s Japanese • Programmer Happiness! - written for humans not for computers • Easy to read and write 5.times { puts "Have some chunky bacon Matz."} ['riverside', 'japan', 'america'].each {|locale| puts locale.capitalize } • Popularized by Ruby on Rails Tuesday, October 19, 2010
  • 7. Install Ruby • Mac Users, I say rejoice, for thou haveth Ruby already! • Windows users - are you prejudiced towards Japan or something?! Let’s fix that by installing Ruby: • http://www.ruby-lang.org/en/downloads/ - run the one-click installer and make sure to de-check the SciTE and check enable ruby gems. Important. • (http://docs.heroku.com/windows) - very helpful. video. Remember - friends don’t let friends use internet explorer. Tuesday, October 19, 2010
  • 8. Database • Where we store our data • MySQL popular • skip Tuesday, October 19, 2010
  • 9. Git • Keeps track of all the code you write • http://code.google.com/p/msysgit/ (windows) • http://code.google.com/p/git-osx-installer/ (mac) • http://github.com (keep your code safe) Tuesday, October 19, 2010
  • 10. Hello World app • [sudo] gem install sinatra • [sudo] gem install unicorn • [sudo] gem install haml • mkdir hello_world • cd hello_world Tuesday, October 19, 2010
  • 11. Hello World app cont. • Create and edit app.rb require 'rubygems' require 'sinatra' get '/' do "Hello World!" end Tuesday, October 19, 2010
  • 12. Hello World app cont. • Create and edit config.ru file require 'app' run Sinatra::Application Tuesday, October 19, 2010
  • 13. Hello World app cont. • Create and edit .gems file for heroku sinatra --version '>= 0.9.4' haml Tuesday, October 19, 2010
  • 14. Hello World app cont. • Run the local server: unicorn -p 3000 • Browse to: http://localhost:3000/ • Congrats! Drink a beer! Tuesday, October 19, 2010
  • 15. Deploy • Sign up on Heroku: http://heroku.com • [sudo] gem install heroku Tuesday, October 19, 2010
  • 16. Deploy cont. • cd into your hello_world project • git init • git add . • git commit -am “initial import” Tuesday, October 19, 2010
  • 17. Deploy cont. • ssh-keygen -C “you@email.com” -t rsa • (leave the passphrase blank unless it’s your computer) Tuesday, October 19, 2010
  • 18. Deploy cont. • heroku create • git push heroku master • heroku rename yourchoice • browse to http://yourchoice.heroku.com Tuesday, October 19, 2010
  • 19. Deploy cont. • Other things you can do • Add an about page • Switch to haml • Add a layout file • Add images under a public folder • Move onto ajax Tuesday, October 19, 2010
  • 20. views/layout.haml !!! %html %head %title Your App %link{:rel=>'stylesheet', :href=>'/stylesheets/ layout.css', :type => "text/css"} / javascripts %script{:type => "text/javascript", :src => "/javascripts/ jquery.js"} %script{:type => "text/javascript", :src => "/javascripts/ index.js"} %body = yield Tuesday, October 19, 2010
  • 21. views/index.haml %h1 Hello World! get '/' do haml :index end Tuesday, October 19, 2010
  • 23. public/javascripts • Add jquery.js - download from jquery.com • Add index.js Tuesday, October 19, 2010
  • 24. public/javascripts/ index.js $(document).ready(function() { alert("It works!"); }); Tuesday, October 19, 2010
  • 25. views/index.haml %h1 Hello World %h2 Search %form{:id => "search_form", :method => "get", :action => "/search"} %input{:type => "text", :id => "search_field", :name => "search_field"} %input{:type => "submit", :value => "Search", :id => "search_btn"} %ul#search_field_value %li= @search_field_value Tuesday, October 19, 2010
  • 26. app.rb (add route) get '/search' do @search_field_value = params[:search_field] haml :index end Tuesday, October 19, 2010
  • 27. public/javascripts/ index.js $(document).ready(function() { $("#search_btn").click(function() { var search_text = $("#search_field").val(); alert(search_text); return false; }); }); Tuesday, October 19, 2010
  • 28. public/javascripts/ index.js $(document).ready(function() { $("#search_btn").click(function() { var search_text = $("#search_field").val(); // alert(search_text); $.ajax({ url: "/search?search_field="+search_text, success: function(responseText, statusText, xhr) { $('#search_field_value').append(responseText); }, error: function(request, statusText, xhr) { alert("There was an error!"); } }); return false; }); }); Tuesday, October 19, 2010
  • 29. public/javascripts/ index.js get '/search' do @search_field_value = params[:search_field] "<li>#{@search_field_value}</li>" end Tuesday, October 19, 2010