Skip to content

Instantly share code, notes, and snippets.

View tripdog's full-sized avatar
💭
meditating

Tom Phillips tripdog

💭
meditating
View GitHub Profile
{
"quotes":[
{
"quote": "Three things cannot be long hidden: the sun, the moon, and the truth.",
"author": "Shakyamuni Buddha"
},
{
"quote": "An idea that is developed and put into action is more important than an idea that exists only as an idea.",
"author": "Shakyamuni Buddha"
},
.line-clamp{
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
overflow: hidden;
}
@tripdog
tripdog / functions.php
Created November 16, 2021 05:59 — forked from EastSideCode/functions.php
WordPress Child theme functions.php
<?php
function add_parent_styles() {
wp_enqueue_style('parent-style', get_template_directory_uri().'/style.css');
}
add_action('wp_enqueue_scripts', 'add_parent_styles');
@tripdog
tripdog / arrayMethods.md
Created July 1, 2021 20:18
Using array methods iterate over a complex object and return values from it

Using array methods iterate over a complex object and return values from it.

const bondFilms = [
  {
    title: "Skyfall",
    year: 2012,
    actor: "Daniel Craig",
    gross: "$1,108,561,008",
  },
@tripdog
tripdog / callBack.md
Created July 1, 2021 20:12
A simple example of a callback

A simple example of a callback

const wordReverse = (string) => {
    let arr = string.split(" ").reverse().join(" ")
    return arr
};

const toUpperCase = (string) => {
    string = string.toUpperCase() 
 return string
@tripdog
tripdog / productPrice.md
Created July 1, 2021 20:10
Using a forEach loop, write a function that gets the name of an item and adds it's price

Using a forEach loop, write a function that gets the name of an item and adds it's price

let products = [
      {
        "name": "allen wrench",
        "price": 2.99,
        "description": "handy tool"
      },
      {
@tripdog
tripdog / declineEverything.md
Last active July 1, 2021 20:06
Write a function that adds a string before each item in an array using a forEach loop.

Write a function that adds a string before each item in an array using a forEach loop and a helper function that's colled inside of the forEach loop.

const veggies = ["broccoli", "spinach", "cauliflower", "broccoflower"];
const politelyDecline = (veg) => {
  console.log("No " + veg + " please. I will have pizza with extra cheese.");
};

const declineEverything = (veggies) => {
    veggies.forEach( veg => {
 politelyDecline(veg)
@tripdog
tripdog / crazyObject.md
Created July 1, 2021 19:58
Access nested array's inside of a complex object

Access nested arrays inside of a complex object

const crazyObject = {
  taco: [{meat: 'steak',
         cheese: ['panela', 'queso', 'chihuahua']},
         {meat: 'chicken',
          salsa: ["pico", "hot", "hotter", "really hot", "really really hot", "omg my mouth is burning"]},
        ],
  larry: {
    nicknames: ["LD", "Chicken Teriyaki Boyyyyyy"],
@tripdog
tripdog / createHTMLwithJS.md
Last active July 1, 2021 20:00
Challenge: create a basic HTML page by importing a JS file into a completely blank HTML page

Master the DOM: Create a simple web page by importing a JS file into a blank HTML page

//wrapping div
const wrapper = document.createElement("div")
document.body.appendChild(wrapper);
wrapper.style.display = "flex"
wrapper.style.alignItems = "center"
wrapper.style.justifyContent = "center"
wrapper.style.width ="100%" 
@tripdog
tripdog / rockPaperScissor.md
Last active June 21, 2021 05:02
Write a Rock, Paper, Scissors Game

Create a rock, paper, scissors game that you play against the computer.

const items = ["rock", "paper", "scissors"]
function game(userInput) {
    let computerInput = items[Math.floor(Math.random() * items.length)]
    console.log(computerInput)
    if (computerInput === userInput) {
        return "This is a tie"
 } else if (computerInput === "rock") {