Skip to content

Instantly share code, notes, and snippets.

View ldco2016's full-sized avatar
🏠
Working from home

Daniel Cortes ldco2016

🏠
Working from home
  • Jacksonville, TX
View GitHub Profile
function main() {
var n = parseInt(readLine());
for (i = 1; i <=n; i++){
line = Array(n).fill(' ');
for (j = 0; j < i; j++){
line[j] = '#';
}
console.log(line.reverse().join(''))
}
q = gets.strip.to_i
for a0 in (0..q-1)
s = gets.strip
# your code goes here
# hackerrank
word = ""
index = 0
s.each_char do |c|
if c == "hackerrank"[index]
word += c
@ldco2016
ldco2016 / anatomyHTML.md
Last active December 8, 2017 18:30
uses Markdown to explain/teach someone that has never seen or used HTML, the following tags: div, h1-h6, anchor, img, video

Of all the computer languages you will read about on my blog, HTML (hypertext markup language) is the simplest. That's because it's not a full fledged programming language. You can't write logical statements using HTML like you can with a programming language like Javascript (where, for instance, you can have code that behaves one way if some condition is true, and another if that condition is false). Instead, HTML is used to mark up content so web browsers know what kinds of content they're dealing with.

For instance, you can use an <h2> tag to tell the browser to render the word "Skills" as a heading, and you can use an unordered list with list items (<ul> and <li>s) to mark up the skills themselves and render them as a bulleted list.

For the most part, that's all there is to HTML: you take content and wrap it in the appropriate tags. You'll get plenty of practice with that throughout your projects, but in the remainder of this reading, I will go over enough background about HTML to code

@ldco2016
ldco2016 / javascript.md
Last active November 8, 2021 07:16
JavaScript: variables (ES6), arrays, conditionals, and loops

Create a Variable: Const

Let's dive in and see a variable in the wild. Here is how you declare a constant variable:

const myName = 'Arya';
console.log(myName);
// Output: Arya

Let's consider the above example:

@ldco2016
ldco2016 / app.js
Created December 25, 2017 23:32
IIFE allows us to have data privacy because it creates a new scope that is not visible from the outside scope.
// immediately invoked function expression
// its an anonymous function wrapped in parentheses
// Step 1: JS Runtime executes this line and this anonymous
// function is declared and immediately called because
// of (); operator below.
var budgetController = (function() {
// Step 2: Then this is declared and it returns an
// object below it.
// this part of the code is private
var x = 23;
@ldco2016
ldco2016 / closure.js
Created December 27, 2017 01:43
This is an example of a closure for self-study
// Closures will blow your mind or make you pull your hair out!
// One of the most difficult topics is that of closures.
// So I will write a small function that returns a function
// that calculates how many years we have left to retirement.
// retirementAge passes the age someone has to have
// in order to retire
function retirement(retirementAge) {
var a = ' years left until retirement.';
@ldco2016
ldco2016 / app.js
Created December 31, 2017 17:48
Budgety app
// immediately invoked function expression
// its an anonymous function wrapped in parentheses
// Step 1: JS Runtime executes this line and this anonymous
// function is declared and immediately called because
// of (); operator below.
var budgetController = (function() {
// Step 2: Then this is declared and it returns an
// object below it.
// this part of the code is private
var x = 23;
@ldco2016
ldco2016 / index.html
Created January 5, 2018 23:50
Filterable contact list
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.css">
<title>Thinkful Contacts</title>
</head>
<body>
// this is vanilla JS to add dynamic behavior to
// a webpage. Can you figure out what this does?
const login = document.getElementById('login');
const loginMenu = document.getElementById('loginMenu');
login.addEventListener('click', () => {
if(loginMenu.style.display === 'none'){
loginMenu.style.display = 'inline';
} else {
loginMenu.style.display = 'none';
@ldco2016
ldco2016 / index.html
Created February 23, 2018 18:39
the html file for responsive web design with Chase
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!--[if lt IE 9]>
<script src="bower_components/html5shiv/dist/html5shiv.js"></script>
<![endif]-->
<title>Responsive Demo</title>