Seeing your static project from your phone

Understanding how your application looks on mobile is a easy just fallow these steps.

First run in your command line:

ifconfig

and the ip address will be under the line:

en0:

as 

inet

One you have your ip address run:

python -m SimpleHTTPServer

then with the ip address type this into your phone’s browser:

YOUR.IP.ADDRESS.WITH.DOTS:THE PORT

ex 172.33.49.1:8000

Screen Shot 2015-07-25 at 8.20.16 PM

Advertisements

Running a Simple Script in Ruby

Hi Everyone!

So I recently had to write a script in Ruby at my job to scrape a webpage for information when I realized… Wait how do you run a ruby script? I was so use to using Rails Server command to run my programs in Rails and had no idea how to do this in a non rails/ Sinatra setting. So to do this of course after you have made your script with a “touch ‘your script name'”.

When you want to run you Ruby script you’d enter the command

ruby -r "./your_script_name.rb" -e "YourClassName.your_method_name 'any parameters in your method'"

So what is going on here when you run the code is your telling the terminal to use ruby then the “-r” tell the terminal to run this program that is followed by the file name which needs the correct location in your computer; in this case the file and location would be:

"./your_script_name.rb"

The “-e” tells the program to go into the the ruby file then run the class method in this case the class would be

"YourClassName"

And the method name would be (with any addional params. If the method has no params just don't include anything after the method call)

your_method_name 'any parameters in your method'"

I hope this would clear up the mystery in running your own simple scripts.