Skip to content

Instantly share code, notes, and snippets.

View GermanHoyos's full-sized avatar
😋
Coding!

German Adrian Hoyos GermanHoyos

😋
Coding!
View GitHub Profile
<script>
let x = arr[i] || ' '; // <-- if arr[i] is falsy (doesnt return a value) x will be the string or the value after the ||
// run a for loop on two conditions being OR true, once one isnt true the other is checked for truth
let indexZro = array[0];
let indexOne = array[1];
for (let i = 0; i < indexZro.length || i < indexOne.length; i++)
//use a object to change global variable localy without declaring locally
let x = 0;
@GermanHoyos
GermanHoyos / player-js-analysis.md
Last active December 13, 2017 23:34 — forked from R-V-S/player-js-analysis.md
player.js analysis
  1. This file declares a class, Player, instantiates it, and assigns it to a global player variable.
  2. The Player class contains four methods:
    • constructor()
    • playPause()
    • skipTo()
    • setVolume()
  3. The constructor() method sets initial values for the currentlyPlaying, playState, volume, and soundObject properties.
    • currentlyPlaying is set to the first item in album.songs.
    • The initial playState is "stopped".
  • The volume is set to the number 80.
import React, { Component } from 'react';
import './App.css';
import ToDo from './components/ToDo.js';
class App extends Component {
constructor(props) { //Initial properties to be default renderd
super(props);
this.state = {
todos: [
import React, { Component } from 'react';
class ToDo extends Component {
render() {
return (
<li>
<input type="checkbox" checked={ this.props.isCompleted } onChange={ this.props.toggleComplete }/>
<span>{ this.props.description }</span>
<button onClick={this.deleteToDo}> Delete this ToDo</button>
</li>
import React, { Component } from 'react';
import './App.css';
import ToDo from './components/ToDo.js';
class App extends Component {
constructor(props) { //Initial properties to be default renderd
super(props);
this.state = {
todos: [
import React, { Component } from 'react';
import albumData from './../data/albums';
class Album extends Component {
constructor(props) {
super(props);
const album = albumData.find( album => {
return album.slug === this.props.match.params.slug
import React, {Component} from 'react';
const testArr1 = [1,2,3];
const testArr2 =[{one:1},{two:2},{three:3}];
class RoomList extends Component {
constructor(props) {
super(props);
this.state = {
rooms: []
import React, {Component} from 'react';
class RoomList extends Component {
constructor(props) {
super(props);
this.state = {
rooms: [],
display: 'none',
displayRoom: 'none',
newRoomName: 'New room',
=begin
Define a class called CheckingAccount that inherits from BankAccount.
Write it so that if more than 3 withdrawals are made, it charges a $5
fee for each transaction afterwards. Use a constant called
MAX_FREE_WITHDRAWALS to set the maximum number of withdrawals before the
fee kicks in. Define a method called get_free_withdrawal_limit to expose
the value of the constant. If there aren't enough funds to cover the fee
and the limit has been reached, it should not make a successful
withdrawal. The class should also have a transfer method that uses an
account to move money from, and an amount to transfer as arguments and
class BankAccount
attr_reader :balance, :number_of_withdrawals
def initialize(balance) #constructor
@balance = balance
@number_of_withdrawals = 0
end
def display_balance
@balance