Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'sinatra'
require './lib/profile'

set :application_id, 'EDIT_ME'
set :secret, 'EDIT_ME'
set :application_id, '7e16da8b68d5bf0c63f71535351d4a9da6ce6aff1b602f82788138aef009d42d'
set :secret, '6212562da0927a6ed927cfbfbd1f59d585d8f3b719463a0d4542b688d4d3c7d1'
set :redirect_uri, 'http://localhost:4567/callback'
set :site_url, 'https://wegotcoders.com'
set :session_secret, 'secret'
31 changes: 29 additions & 2 deletions primes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
class Primes
def self.sum_to(limit = 100)
# TODO - add your prime number solution here...
"I'm working on it!"

num = 1
last = 100
primes = []

while (num <= last)
condition = true
x = 2

while (x <= num / 2)
if (num % x == 0)
condition = false
break
end

x = x + 1

end
end

if condition && num > 1

primes << num

end

num = num + 1

end

print primes.inject(:+)
Binary file added public/images/codecademy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/picture.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 61 additions & 6 deletions public/stylesheets/main.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,75 @@
header, footer {
padding: 1em;
color: black;
background-color: orange;
clear: left;
text-align: center;
}


.newspaper {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
-webkit-column-gap: 40px; /* Chrome, Safari, Opera */
-moz-column-gap: 40px; /* Firefox */
column-gap: 40px;
-webkit-column-rule: 1px solid lightblue; /* Chrome, Safari, Opera */
-moz-column-rule: 1px solid lightblue; /* Firefox */
column-rule: 1px solid lightblue;
}

h3 {
-webkit-column-span: all; /* Chrome, Safari, Opera */
column-span: all;
}

* {
padding: 0;
margin: 0;
}
.fit { /* set relative picture size */
max-width: 100%;
max-height: 100%;
}
.center {
display: block;
margin: auto;
}


body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.428571429;
color: #333;
width: 50%;
margin: auto;
}

#logo {
table, th{
border: 0px solid black;
border-collapse: collapse;
text-align: left;
}

table, td{

text-align: center;
}


}
#logo {
text-align: right;
}

#content {
padding: 1em;
}

.box {
border: 1px solid #999;
border: 0px solid #999;
background: #FCFCFC;
padding: 1em;
margin-bottom: 0.5em;
@@ -27,13 +82,13 @@ body {
h3 {
font-size: 1.5em;
}

h4{
font-style: bold;
}
.error {
text-align: center;
}

.error h2 {
font-size: 1.5em;
}

/* TODO - Add your own styles here */
}
221 changes: 203 additions & 18 deletions views/index.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,199 @@
<% if @profile %>
<h3><%= @profile["first_name"] %>'s Amazing Profile</h3>

<!-- TODO- Perhaps re-jig this to fit your new design / layout -->
<% @profile.each do |field, value| %>
<div class="profile-section box">
<h4><%= field %></h4>
<p class="profile-value"><%= value %></p>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>We Got Coders - My Amazing Application</title>
<link rel="stylesheet"
type="text/css"
href="public\stylesheets\reset.css"/>


<link rel="stylesheet"
type="text/css"
href="public\stylesheets\main.css"/>



<script type="text/javascript">

function countWords(){
s = document.getElementById("inputString").value;
s = s.replace(/(^\s*)|(\s*$)/gi,"");
s = s.replace(/[ ]{2,}/gi," ");
s = s.replace(/\n /,"\n");
document.getElementById("wordcount").value = s.split(' ').length;
}
</script>


</head>


<body>


<header>
<a href="https://www.wegotcoders.com/courses"> <img src="public\images\logo.png"> </a>
<a href="https://www.linkedin.com/in/tudor-dan-petrescu-84b72660/"> <img src="public\images\picture.jpg" align="left" height="110" width="150"> </a>

<strong align="center"><a href="mypage.erb" align="center">2nd Page</strong>

</header>

<h3><a href="https://www.youtube.com/watch?v=tRFHXMQP-QU">Tudor-Dan's Supercalifragilisticexpialidocious Profile</a></h3>

</br>

<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3!1d19702.199099085192!2d-0.3938307!3d51.883321599999995!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2suk!4v1498257236740" width="400" height="200" frameborder="0" style="border:0" align="right" allowfullscreen></iframe>

<div class="profile-section">

<p>ID: <strong class="profile-value">2976</strong> </p>
</div> </td>

<div class="profile-section">
<p>Email: <strong class="profile-value">tudordanp@gmail.com</strong></p>
</div>

<div class="profile-section">
<p>First name: <strong class="profile-value">Tudor-Dan</strong></p>

</div>

<div class="profile-section">
<h4>Last name: <strong class="profile-value">Petrescu</strong></h4>
</div>

<div class="profile-section">
<h4>Phone number: <strong class="profile-value">07496093640</strong></h4>
</div>

<div class="profile-section">
<h4>Gender: <strong class="profile-value">Male</strong> </h4>

</div>

<div class="profile-section">
<h4>DOB: <strong class="profile-value"><select>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
</select>
<select>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
<select>
<option value="1988">1988</option>
<option value="1989">1989</option>
<option value="1990">1990</option>
<option value="1991">1991</option>
</select>
</strong></h4>

</div>

<div class="profile-section">
<h4>Twitter: <strong class="profile-value">cowilkscow</strong></h4>

</div>

<div class="profile-section">
<h4>Github: <strong class="profile-value">cowmilkscow</strong></h4>

</div>

<div class="profile-section">
<h4>Nickname: <strong class="profile-value">MotherBoard</srtong></h4>

</div>
<% end %>

</div>


</br>
<div class="newspaper">
<div class="profile-section">
<h3>About Me:</h3>
<strong class="profile-value">My name is Tudor-Dan Petrescu. I am the kind of a person that continuously challenges himself. Whenever I feel that I am stuck in my comfort zone, I try to run from it. I am always looking for ways to improve and develop myself in order to never stop growing as a person and as a professional. I have studied marketing because of my creative side, believing that this will be a good way of putting my aptitudes in value, and I was right. Before leaving Romania to study an MSc in Uk, I had my own advertising company and had been in charge of another company helping it grow and develop in a profitable business. I love writing, being in nature, honesty, and reality. </strong>
</div>
</div>
</br>
<div class="newspaper">
<div class="profile-section">
<h3>Projects:</h3>
<strong class="profile-value">I have done a C++ course that helped me understand better what coding is about. I have done a few websites in HTML and a bit of javascript. My best experience with a programming project, was before I knew too much about it, I gave a solution to the IT department while they were developing a web app and got stuck. I can say that was the point when I discovered that I want to know more about the subject. </strong>
</div>
</div>
</br>
<div class="newspaper">
<div class="profile-section">
<h3>Rationale:</h3>
<strong class="profile-value">I found my passion for programming when I was doing HTML web pages, but they were too simple and I tried to look a bit in Javascript. What made me so interested was the challenge of understanding how things are created in machine language, and how it works, from code to reality. I want to apply to this program because I think I can combine what I have studied with programming and all my experience will help me, master this domain in time. I find it extremely interesting and addictive to read, understand and write code, and because this will be a structured way of learning what I want. </strong>
</div>
</div>
</br>
<div class="newspaper">
<div class="profile-section">
<h3>Ambition:</h3>
<strong class="profile-value">I want to improve and enrich my knowledge in order to be able to put my creativity to a good use. I want to be able to create web applications. To have a better understanding of programming languages, other than C++. I want to understand databases better, and how to work with them. </strong>

</div>
</div>
</br>
<div class="newspaper">

<div class="profile-section">

<h3>Learning experience: </h3>
<strong>Having a nice environment with people that are willing to share their experience and knowledge.
Working on various assignments in teams, in order to have a better understanding of the learning material.
Plenty examples from practical applications of the things we learn.</strong>


</div>
</div>
</br>

<div>
<div class="profile-section">

<h3>How did you hear:</h3>
<strong class="profile-value">From a friend, that found the ad through the university job site.</Strong>

</div>
</br>
<form name="form1" method="post" action="">
<h3> How about the future?</h3>
<textarea name="inputString" id="inputString" cols="70" rows="7"> Mix me, steer my sight because only you can make my blood move in the rythm of your heart beat. Complicate my world with just a touch of faith, when I can not hold my thougths in chains of peace and make me feel the all in the nothing, and do that like an ordinary thing. Drops of water will never look just like rain because you rewrite the normal and make the natural surreal, making the story look like a fairytale with real people. </textarea>
</br>
<input type="button" name="Convert" value="Count Words" onClick="countWords();">
<input name="wordcount" id="wordcount" type="text" value="" size="6">
</form>
</br>

<div class="profile-section box">
<h3>Primes sum</h3>
<p class="profile-value">1060</p>
</div>


<div id="stats" class="box">
<h3>Stats</h3>
<!-- TODO - Set the contents of this span with JavaScript -->
<span id="word-count">0</span> words found.
</div>


<div id="problems" class="box">
<h3>Programming Problems</h3>
<a href="/primes">My Prime Number Solution</a>
<a href="primes.erb">My Prime Number Solution is 1060</a>
</div>

<div class="box">
@@ -27,7 +203,7 @@
<fieldset>
<div class="form-group">
<label for="trainee[about]">About</label>
<input type="text" name="trainee[about]" value="<%= @profile["about"] %>"/>
<input type="text" name="trainee[about]" value="My name is Tudor-Dan Petrescu. I am the kind of a person that continuously challenges himself. Whenever I feel that I am stuck in my comfort zone, I try to run from it. I am always looking for ways to improve and develop myself in order to never stop growing as a person and as a professional. I have studied marketing because of my creative side, believing that this will be a good way of putting my aptitudes in value, and I was right. Before leaving Romania to study an MSc in Uk, I had my own advertising company and had been in charge of another company helping it grow and develop in a profitable business. I love writing, being in nature, honesty, and reality."/>
</div>

<!-- TODO - Add more fields so that your profile can be edited -->
@@ -36,13 +212,9 @@
</fieldset>
</form>
</div>
<% else %>
<div class="welcome">
<p>Welcome! Once you have updated the OAuth tokens, the link below will fetch your profile information.</p>

<a href="/authorise">Authorise</a>
</div>
<% end %>
</br>



<!-- Add your Javascript to this script tag -->
@@ -55,5 +227,18 @@
// TODO - Count the number of words in the profile.
// hint - look at what the innerHTML property provides.

document.getElementById('word-count').innerHTML = total_words;
</script>
document.getElementById('word-count').innerHTML = total_words;
</script>
</div>




<footer>Tudor-Dan Petrescu</footer>


</body>



</html>
97 changes: 97 additions & 0 deletions views/mypage.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>We Got Coders - My Amazing Application</title>
<link rel="stylesheet"
type="text/css"
href="public\stylesheets\reset.css"/>


<link rel="stylesheet"
type="text/css"
href="public\stylesheets\main.css"/>

<header>
<a href="https://www.wegotcoders.com/courses"> <img src="public\images\logo.png"></a>
<a href="https://www.linkedin.com/in/tudor-dan-petrescu-84b72660/"> <img src="public\images\picture.jpg" align="left" height="110" width="150">

<a href="index.erb" align="center">1st Page</a>

</header>



</head>


<body>

<a href="https://www.codecademy.com/cowmilkscow"> <img class="center fit" src="public\images\codecademy.png"></a>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="JavaScript">
function set_body_height() { // set body height = window height
$('body').height($(window).height());
}
$(document).ready(function() {
$(window).bind('resize', set_body_height);
set_body_height();
});
</script>




</br>

<button onclick="myFunction1()">What is your name?</button>

<p id="demo1"></p>

<script>
function myFunction1() {
var person = prompt("Please enter your name, mine is Tudor!", "Name");
if (person != null) {
document.getElementById("demo1").innerHTML =
"Hello " + person + "! How are you today?";
}
}

</script>

</br>


<button onclick="myFunction()">Tell me, how?</button>

<p id="demo"></p>

<script>
function myFunction() {
var text;
var favDrink = prompt("How are you today?", "Fine");
switch(favDrink) {
case "sad":
text = "Do not worry, it is just one day!";
break;
case "Fine":
text = "That is great!";
break;
case "happy":
text = "Really? That sounds amasing!";
break;
default:
text = "You are special!";
}
document.getElementById("demo").innerHTML = text;
}


</script>
</br>
<footer>Tudor-Dan Petrescu</footer>

</body>
83 changes: 79 additions & 4 deletions views/primes.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,82 @@
<h1>Prime Numbers</h1>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>We Got Coders - My Amazing Application</title>
<link rel="stylesheet"
type="text/css"
href="public\stylesheets\reset.css"/>


<link rel="stylesheet"
type="text/css"
href="../public/stylesheets/main.css"/>

<header>
<a href="https://www.wegotcoders.com/courses"> <img src="public\images\logo.png"></a>
<a href="https://www.linkedin.com/in/tudor-dan-petrescu-84b72660/"> <img src="public\images\picture.jpg" align="left" height="110" width="150">

<a href="mypage.erb" align="center">2nd Page</a>

</header>


</head>


<body>

<h3>Sum: </h3>

<iframe class="center fit" src="https://codepad.remoteinterview.io/QAHSPRFRXO" width="768" height="550" frameborder="0" style="border:0" allowfullscreen></iframe>




<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="JavaScript">
function set_body_height() { // set body height = window height
$('body').height($(window).height());
}
$(document).ready(function() {
$(window).bind('resize', set_body_height);
set_body_height();
});
</script>

Sum : <%= @sum %>

<div>
<a href="/">Back</a>
</div>
<h3><a href="index.erb">Back</a></h3>
</div>



<!--
require 'cgi'
require 'prime'
array_of_primes = []
start_time = Time.now
(1..100).each do |n|
if Prime.prime?(n)
array_of_primes << n
end
end
answer = array_of_primes.inject(:+)
duration = Time.now - start_time
puts "Sum of primes below #{100} is #{answer}. Took #{duration} s to calculate using my Ruby's Prime.prime? method."
I found the code online, and i have tried to integrate it into the html. The only way i could figure was to integrate an iframe with a ruby compiler. I would have made it work, but i did not wanted to submitt too late.
//-->




<footer>Tudor-Dan Petrescu</footer>

</body>
Binary file added views/public/images/codecademy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added views/public/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added views/public/images/picture.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions views/public/stylesheets/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
header, footer {
padding: 1em;
color: black;
background-color: orange;
clear: left;
text-align: center;
}


.newspaper {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
-webkit-column-gap: 40px; /* Chrome, Safari, Opera */
-moz-column-gap: 40px; /* Firefox */
column-gap: 40px;
-webkit-column-rule: 1px solid lightblue; /* Chrome, Safari, Opera */
-moz-column-rule: 1px solid lightblue; /* Firefox */
column-rule: 1px solid lightblue;
}

h3 {
-webkit-column-span: all; /* Chrome, Safari, Opera */
column-span: all;
}

* {
padding: 0;
margin: 0;
}
.fit { /* set relative picture size */
max-width: 100%;
max-height: 100%;
}
.center {
display: block;
margin: auto;
}


body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.428571429;
color: #333;
width: 50%;
margin: auto;
}

table, th{
border: 0px solid black;
border-collapse: collapse;
text-align: left;
}

table, td{

text-align: center;
}


}
#logo {
text-align: right;
}

#content {
padding: 1em;
}

.box {
border: 0px solid #999;
background: #FCFCFC;
padding: 1em;
margin-bottom: 0.5em;
}

.welcome {
text-align: center;
}

h3 {
font-size: 1.5em;
}
h4{
font-style: bold;
}
.error {
text-align: center;
}

.error h2 {
font-size: 1.5em;
}
48 changes: 48 additions & 0 deletions views/public/stylesheets/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}