Skip to content

Instantly share code, notes, and snippets.

View pablocortez's full-sized avatar

Pablo Cortez pablocortez

View GitHub Profile
#include <iostream>
using namespace std;
int main()
{
int number_to_find = 7;
int array[] = { 1, 3, 4, 6, 7, 8, 10, 13, 14, 18, 19, 21, 24, 37, 40, 45, 71 };
int min = 0;
int max = (sizeof(array) / sizeof(*array) - 1); // last index value
@pablocortez
pablocortez / main.cpp
Created May 1, 2017 18:08
Telephone Records
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string names[10];
long long numbers[10];
int namesLength = (sizeof(names) / sizeof(*names));
int numbersLength = (sizeof(numbers) / sizeof(*numbers));
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string names[10];
long long numbers[10];
int namesLength = (sizeof(names) / sizeof(*names));
int numbersLength = (sizeof(numbers) / sizeof(*numbers));
function reverseString(str) {
return str.split('').reverse().join('');
}
reverseString("hello");
// GET LOCATION
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#data").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);
});
}
function make2DArray(cols, rows) {
var arr = new Array(cols);
for (var i = 0; i < arr.length; i++) {
arr[i] = new Array(rows);
}
return arr;
}
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10){
dd='0'+dd
}
if(mm<10){
@pablocortez
pablocortez / fizzbuzz.js
Created March 20, 2016 04:15
A breakdown of an elegant Fizzbuzz solution.
// Expanded version
for (var i = 1; i < 100; i++) {
var f = i % 3 == 0, b = i % 5 == 0;
if (f) {
if (b) {
console.log("Fizzbuzz")
} else {
console.log("Fizz");
}
} else if (b) {
@pablocortez
pablocortez / Valentine's Day Project.markdown
Created February 16, 2016 03:28
Valentine's Day Project

Valentine's Day Project

How would you know the difference between the dream world and the real world?

A Pen by Pablo Cortez on CodePen.

License.