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
| # people is some subset from the Persons table | |
| people = people.where("UPPER(first_name) LIKE UPPER(?) OR UPPER(last_name) LIKE UPPER(?)", "%" + params[:fname] + "%", "%" + params[:lname]+ "%") |
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
| # people is some subset from the Persons table | |
| people = people.where("UPPER(first_name) = UPPER(?) OR UPPER(last_name) = UPPER(?)", params[:fname], params[:lname]) |
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
| //In O(n) time, and using O(1) space, remove duplicates from an array | |
| func removeDups(arr []int) []int { | |
| nextUnduplicatedIdx := 1 | |
| //O(n) time complexity | |
| for i := 1; i < len(arr); i++ { | |
| //if the adjacent elements are not equal, assign the element at i to our nextUnduplicatedIdx | |
| if arr[nextUnduplicatedIdx-1] != arr[i] { | |
| arr[nextUnduplicatedIdx] = arr[i] | |
| nextUnduplicatedIdx++ | |
| } |
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
| func removeDupsAlt(arr []int) []int { | |
| h := make(map[int]bool) | |
| //O(n) time complexity | |
| for i := 0; i < len(arr); i++ { | |
| h[arr[i]] = true | |
| } | |
| //O(n) space complexity | |
| keys := make([]int, len(h)) |
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
| # will recursively transfer all the files in ./your_static_files | |
| scp -i "your-key.pem" -r ./your_static_files ubuntu@ec2-<your-ip>compute-1.amazonaws.com:~/ |
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
| # will recursively transfer all the files in ./your_static_files | |
| scp -i "your-key.pem" -r ./your_static_files ubuntu@ec2-<your-ip>compute-1.amazonaws.com:~/ |
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
| ssh -i "your-key.pem" ubuntu@ec2-<your-ip>.compute-1.amazonaws.com |
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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "strings" | |
| "github.com/aws/aws-sdk-go/aws" | |
| "github.com/aws/aws-sdk-go/aws/credentials" |
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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "strings" | |
| "github.com/aws/aws-sdk-go/aws" | |
| "github.com/aws/aws-sdk-go/aws/credentials" |
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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "strings" | |
| "github.com/aws/aws-sdk-go/aws" | |
| "github.com/aws/aws-sdk-go/aws/credentials" |