Skip to content

Instantly share code, notes, and snippets.

View GermanHoyos's full-sized avatar
🧬
The most advanced code is DNA

German Adrian Hoyos GermanHoyos

🧬
The most advanced code is DNA
View GitHub Profile
import React, {Component} from 'react';
class RoomList extends Component {
constructor(props) {
super(props);
this.state = {
rooms: [],
display: 'none',
displayRoom: 'none',
newRoomName: 'New room',
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';
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';
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: [
@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.
<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;