Skip to content

pdornfel/rails-tricks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

A place for tricks of the trade.

Table of Contents

  1. CSS
  2. jQuery
  3. Random
  4. Hashes

CSS

pseudo elements

You can add html elements using css like commas to lists by using ::after css selector

after each <span> element add a comma =>

#sales-tool-office-list span::after {
  content: ', ';
}

on the last <span> in the list of spans dont have a comma =>
::last-child is a psuedo element css selector

#sales-tool-office-list span::last-child::after {
  content: none;
}
pseudo classes

give the color to all anchor tags on hover.

a:hover {
    color: #FF00FF;
}

jQuery

shorthand document ready function

$(function(){ 
	//jQuery code here 
});

Random

to tunnel to localhost:3000 on the same network for mobile testing (besides running the ios simulator on xcode)

$ifconfig from the command line

en0 = ethernet0 en2 = ethernet1

look for inet for ethernet0 (wifi) or ethernet1 (ethernet)

<inet>:3000 will forward to your static ip on your network and forward to port 3000

Hashes

cool way to rename keys in a hash

hash[:new_key] = hash.delete(:old_key)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published