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
var str = 'tyiyrHFTH'; | |
function firstRepeatingLetter(string) { | |
var exp = /(.).*(\1)/g; | |
var res = exp.exec(string); | |
return res ? res[1] : string.length ? string[0] : null; | |
} | |
console.info(firstRepeatingLetter(str)); |
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
for (var i = 1; i <= 15; i++) { | |
if (i % 3 === 0 && i % 5 === 0) { | |
console.log("FizzBuzz"); | |
} | |
else if (i % 3 === 0) { | |
console.log("Fizz"); | |
} | |
else if (i % 5 === 0) { | |
console.log("Buzz"); | |
} |
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
{ | |
"countries": { | |
"country": [ | |
{ | |
"countryCode": "AD", | |
"countryName": "Andorra", | |
"currencyCode": "EUR", | |
"population": "84000", | |
"capital": "Andorra la Vella", | |
"continentName": "Europe" |
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
class Pet | |
attr_reader :color, :breed | |
attr_accessor :name | |
def initialize(color, breed) | |
@color = color | |
@breed = breed | |
@hungry = true | |
end |
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
class Cat | |
attr_reader :color, :breed | |
attr_accessor :name | |
def initialize(color, breed) | |
@color = color | |
@breed = breed | |
@hungry = true | |
end |
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
def fav_foods | |
food_array = [] | |
3.times do | |
puts "Name a favorite food." | |
food_array << gets.chomp | |
end | |
puts "You favorite foods are #{food_array.join(", ")}." | |
p food_array | |
food_array.each do |food| | |
puts "I like #{food} too!" |
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
if (5+5==10) | |
puts "this is true" | |
else | |
puts "this is false" | |
end |
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
def greeting(name) | |
puts "Please enter your name:" | |
name = gets.chomp | |
puts "Hello" + " " + name | |
end | |
greeting("Tiago") |
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
//work page | |
var works = [ | |
{ | |
title: "Your next project featured here", | |
pic: "img/screenshot_future.jpg", | |
url: "#contact", | |
text_color: "blue", | |
}, | |
{ |
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
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p = | |
/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js = | |
d.createElement(s);js.id=id;js.src=p+ | |
'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore | |
(js,fjs);}}(document, 'script', 'twitter-wjs'); | |
NewerOlder