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
// Import a library to help create a component
import React, { Component } from 'react';
import { Text, View } from 'react-native';
import axios from 'axios';
// ES6 Class Component
class AlbumList extends Component {
// initializing component level state
// to get access to data and rerender
// this.state.albums equal to empty array
@ldco2016
ldco2016 / index.html
Created March 19, 2018 22:45
Practicing the Box Model
<!DOCTYPE html>
<html>
<head>
<title>The Terminal - Your Source for Fact-Based News</title>
<link href="https://fonts.googleapis.com/css?family=Amatic+SC|Raleway:100,200,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<nav class="navigation">
@ldco2016
ldco2016 / script.js
Created March 24, 2018 17:50
example of my version of the beginning stages of the JavaScript for a quiz app
var output = document.getElementById('output');
var myData = '[{"question":"What color is an apple?","answers":["Blue","Red","Purple"],"correct":1},{"question":"What color is grass?","answers":["Green","Red","Purple"],"correct":0}]'
var myObj = JSON.parse(myData);
for (var i in myObj) {
output.innerHTML += myObj[i].question + '? <br>';
}
output.innerHTML = myObj[0].question;
console.log(myObj);
@ldco2016
ldco2016 / index.js
Created April 30, 2018 21:15
seating capacity JS
set seatingCapacity(newCapacity) {
if (typeof newCapacity === 'number') {
this._seatingCapacity = newCapacity;
console.log(`${newCapacity} is valid input.`);
} else {
console.log(`Change ${newCapacity} to a number.`)
}
}
}
@ldco2016
ldco2016 / index.js
Created June 11, 2018 21:06
Plucking Values
var images = [
{ height: '34px', width: '39px' },
{ height: '54px', width: '19px' },
{ height: '83px', width: '75px' },
];
var heights;
@ldco2016
ldco2016 / closure.js
Created June 16, 2018 00:23
example of Closure
// Creates an object that can be decremented or incremented.
// Note that value can never be changed without using
// increment or decrement. This illustrates a use of closure
// the increment, decrement, getValue functions have access
// to value since functions inherit their outer scope.
//
// But note that there's no way to modify value except by
// using the increment and decrement functions. Thus,
// closures can be used to enforce privacy.
function getCounter(value) {
@ldco2016
ldco2016 / update.js
Created June 18, 2018 23:46
a couple of options
it('A model class can update one record', (done) => {
assertName(User.findOneAndUpdate(joe._id, { name: 'Bill' }), done);
});
it('A model class can find a record with an Id and update', (done) => {
assertName(User.findByIdAndUpdate(joe._id, { name: 'Bill' }), done);
});
@ldco2016
ldco2016 / ternary.js
Created July 3, 2018 00:10
Control Flow
let isNightTime = true;
if (isNightTime) {
console.log('Turn on the lights!');
} else {
console.log('Turn off the lights!');
}
@ldco2016
ldco2016 / dvic_card_gallery.js
Created September 6, 2018 16:42
show event on base class
@ldco2016
ldco2016 / GiftCard.jsx
Created September 12, 2018 23:30
conflicted file
import React from 'react';
import Tooltip from "../Widgets/Tooltip";
import BackupPaymentBlurb from "./BackupPaymentBlurb";
import CardPayment from "./CardPayment";
import {normalizeCreditCard} from '../../lib/Format';
import errorStrings from '../../assets/strings/errors.json';
import store from '../../store';
import PaymentMethodsFromWallet from './PaymentMethodsFromWallet';
import config from '../../config';