This file contains 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
name = "Sharnie Ivery" | |
<<-`GREET` | |
hostname | |
whoami | |
GREET | |
# => "sharnieivery" |
This file contains 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
name = "Sharnie Ivery" | |
<<-'GREET' | |
Hello, #{name} | |
GREET | |
# => "Hello, #{name}" |
This file contains 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
name = "Sharnie Ivery" | |
<<-GREET | |
Hello, #{name} | |
GREET | |
# => "Hello, Sharnie Ivery" |
This file contains 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
var toRoman = function(num){ | |
var range, numerals, roman_numeral, i; | |
range = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; | |
numerals = "M CM D CD C XC L XL X IX V IV I".split(" "); | |
roman_numeral = ""; | |
for(i=0;i<range.length;i++){ | |
while(num >= range[i]){ | |
num -= range[i]; |
This file contains 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 the string | |
var string = 'Hello World!'; | |
// Encode the String | |
var encodedString = btoa(string); | |
console.log(encodedString); // Outputs: "SGVsbG8gV29ybGQh" | |
// Decode the String | |
var decodedString = atob(encodedString); | |
console.log(decodedString); // Outputs: "Hello World!" |
This file contains 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
r | |
Read-only mode. The file pointer is placed at the beginning of the file. This is the default mode. | |
r+ | |
Read-write mode. The file pointer will be at the beginning of the file. | |
w | |
Write-only mode. Overwrites the file if the file exists. If the file does not exist, creates a new file for writing. | |
w+ |
This file contains 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
{ | |
"cmd": ["/usr/local/bin/node", "$file", "$file_base_name"], | |
"working_dir": "${project_path:${folder}}", | |
"selector": "*.js" | |
} |
This file contains 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
def prime? num | |
return false if num <= 1 | |
i = 2 # starting point | |
while i < num | |
return false if num % i == 0 # num is not prime | |
i += 1 # increment i | |
end | |
return true # if the number is prime | |
end |
This file contains 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
<form action="?" method="get"> | |
<input type="text" name="q" placeholder="Search Instagram photos..." autofocus/> | |
</form> | |
<% @results.each do |instagram| %> | |
<%= image_tag instagram.images.low_resolution.url %> | |
<% end %> |
This file contains 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
class SearchController < ApplicationController | |
def index | |
access_token = " " # <= YOUR ACCESS TOKEN HERE | |
client = Instagram.client(access_token: access_token) | |
default_search = client.tag_search('chicken') | |
if params[:q] | |
search_query = client.tag_search(params[:q]) | |
@tag = search_query.present? ? search_query : default_search | |
else |