Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Juan Moises Torrijos moitorrijos

🏠
Working from home
View GitHub Profile
View CSS Open Door Effect.markdown
@moitorrijos
moitorrijos / getgreeting
Created May 26, 2013
a javascript function to display a Greeting on a website depending on the hour of the day on the client's computer.
View getgreeting
//getGreeting function
function getGreeting (hour) {
hour = hour || new Date().getHours();
if (typeof hour === "number"){
if (hour <= 12) {
return "Good Morning";
} else if (hour <= 17) {
return "Good Afternoon";
} else {
@moitorrijos
moitorrijos / quad-equation-solver.js
Created Feb 18, 2013
A quadratic equation solver in JS
View quad-equation-solver.js
var quadEquationSolver = function (a, b, c) {
var rootPart = Math.sqrt( (b * b) - (4 * a * c) );
var denom = 2 * a;
var firstRoot = (-b + rootPart)/denom;
var secondRoot = (-b - rootPart)/denom;
console.log("The first root is " + firstRoot);
console.log("The second root is " + secondRoot);
};