Posts Tagged ‘web-design’

Rails: Add Authentication to Your Ruby on Rails Website in 4 Easy Steps

Step 1
In the terminal:

gem install Devise
bundle install
rails generate devise:install
rails generate devise user
rake db:migrate

Step 2
In seeds.rb:

user = User.create(email: 'name@name.com', password: 'password1', password_confirmation: 'password1')

Step 3
In the terminal:

rake db:seed

A route will be automatically created by the devise gem

Step 4

In _topnav.html.erb:
Add an if statement to check if the user is logged in:

if user_signed_in?

rubylang

Shiny: Get rid of row numbers/names in renderTable

The code below will allow you to get rid of those annoying and visually unattractive row names in your table and you can pass any other options available in xtable in the same way:

output$someTable <- renderTable({
       df()$stuff         
    }, 
    include.rownames=FALSE)

shiny_logo

HTML: Include CSS in 1 Line using the Link Element

<link href="style.css" rel = "stylesheet">

jQuery: 3 Main Uses of jQuery in Websites

1. Events. Respond to user interactions.
2. DOM Manipulation. Modify HTML elements on the page.
3. Effects. Add animations.

a la CodeCademy.com

Ready, set, go! Waiting on Page Loads in JavaScript

Another JavaScript basic — use $(document).ready() to wait for an HTML document to load completely before running whatever function you put in ready()

Quick Tip: Use toggle() and show() in JavaScript Menus

Continuing the series of posts on basic JavaScript:

toggle() alternates something between showing itself and hiding, usually based on a .click() function

show(), on the other hand, conditionally show an element, but don’t let it disappear like toggle() does

Both are widely useful, with menus being a common use case.