This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Below are the setups to run Ruby on Rails application on your system. | |
| Make sure Ruby is installed on your system. Fire command prompt and run command: | |
| ruby -v | |
| Make sure Rails is installed | |
| rails -v | |
| If you see Ruby and Rails version then you are good to start, other wise Setup Ruby On Rails on Ubuntu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DPC Watchdog Violation on Windows 10 can be fix by certain methods shown here. | |
| Message displays "Your PC ran into a problem and needs to restart. We're just collecting some error info, and then you can | |
| restart" | |
| Step 1:Press Windows and R buttons togther | |
| Step2: Type "control sysdm.cpl" and press ok | |
| Step 3: Go to System Properties and select Advanced | |
| Step 4: Go to Start Up and Recovery and remove tick mark near Automatically restart | |
| Step 5: Restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. You mast have a public key from your mashine stored on github as SSH key here: | |
| https://github.com/settings/ssh | |
| How to create ssh key on unix/mac os x: | |
| - Open terminal, go to the root typing: $ cd ~ (recommended) | |
| - Type: ssh-keygen -t rsa -C "your@email.address" | |
| - To secure your ssh key ststem will ask you for passphrase (recommended) but you can skip it also | |
| - That's you have the ssh key | |
| - Check it with: $ ls -al ~/.ssh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define method | |
| def romanize(num) | |
| # define values with hash | |
| digits = { | |
| 1000 => "M", | |
| 900 => "CM", 500 => "D", 400 => "CD", 100 => "C", | |
| 90 => "XC", 50 => "L", 40 => "XL", 10 => "X", | |
| 9 => "IX", 5 => "V", 4 => "IV", 1 => "I" | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Problem: Every push prompt me to input username and password. | |
| I would like to avoid it for every push, but how to configure to avoid it? | |
| Answer: Using SSH authentication on terminal. | |
| 1. Generate an SSH key | |
| Linux/Mac | |
| Open terminal to create ssh keys: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| * ORM is Object Relational Mapper. It means you don't have to manually call the database yourself; the ORM handles it for you. | |
| * Ruby on Rails uses one called ActiveRecord, and it's a really good one. | |
| * ORM allows you to do things such as: | |
| User.find(50).contacts | |
| Instead of manually writing a SELECT statement with JOINs, WHEREs, etc. | |
| ********** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| An API is an “application program interface”, which basically means a computer program that allows other programs to | |
| communicate with it. In our case, our program will be a web application, and we want to make it easy for other web apps | |
| to connect to it. | |
| Example: let’s say I want to build a simple web app that searches Twitter for tweets that contain certain keywords. | |
| I can use Twitter’s search API to do just that by sending a request for data to their servers and then manipulating or | |
| displaying that data on my app. There are tons of APIs out there that make their data available to developers for things | |
| like movie times, restaurant reviews, social media, any pretty much everything else. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Algorithm and Data Structures | |
| # More details: http://www.theodinproject.com/ruby-programming/common-data-structures-and-algorithms | |
| # Implementation of Insertion Sort. | |
| # Insertion Sort ************************ | |
| # Insertion Sort -> A popular quadratic sorting algorithm with O(n^2) complexity | |
| def insertionSort(arr) | |
| for size in 2..arr.length | |
| # Remember, this is a zero-start array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Selection Sort | |
| #The Selection Sort is a popular quadratic sorting algorithm, which has been discussed in detail, with examples and C code over here : Arrays and Sorting: Selection Sort ( with C Program source code). In this tutorial, we will take a quick look at the ruby implementation of Selection Sort. | |
| # Selection Sort ************************* | |
| # Selection Sort -> A popular quadratic sorting algorithm with O(n^2) complexity | |
| # For Index [i] -> swap the i-th smallest element from (array[i]....array[length-1]) with array[i-1] | |
| def selectionSort(arr) | |
| for index in 0..(arr.length-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #The Quick Sort is a popular sorting algorithm, which has been discussed in detail, with examples and C code over here : Arrays and Sorting: Quick Sort ( with C Program source code). In this tutorial, we will take a quick look at the ruby implementation of Quick Sort. | |
| #1 | |
| def partition arr, lo, hi | |
| i,j = lo+1,hi | |
| while true |