Skip to content

Instantly share code, notes, and snippets.

View JeffreyWay's full-sized avatar

Jeffrey Way JeffreyWay

View GitHub Profile
<?php
// Connect to the MySQL database.
$dsn = "mysql:host=localhost;port=3306;dbname=myapp;user=root;charset=utf8mb4";
// Tip: This should be wrapped in a try-catch. We'll learn how, soon.
$pdo = new PDO($dsn);
$statement = $pdo->prepare("select * from posts where id = 1");
$statement->execute();
@JeffreyWay
JeffreyWay / index.php
Last active October 3, 2022 18:34
PHP for Beginners, Episode 10 - Separate Logic From the Template https://laracasts.com/series/php-for-beginners-2023-edition/episodes/10
<?php
$books = [
[
'name' => 'Do Androids Dream of Electric Sheep',
'author' => 'Philip K. Dick',
'releaseYear' => 1968,
'purchaseUrl' => 'http://example.com'
],
[
@JeffreyWay
JeffreyWay / homework-solution.php
Created September 29, 2022 17:36
PHP for Beginners, Episode 9 - Lambdas and Flexibility
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<?php
$books = [
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<?php
$movies = [
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<?php
$books = [
@JeffreyWay
JeffreyWay / homework-solution.php
Last active April 23, 2024 11:56
PHP For Beginners, Episode 6 - Arrays
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<?php
$usernames = [
@JeffreyWay
JeffreyWay / homework-solution.php
Last active August 4, 2023 20:42
PHP For Beginners, Episode 5 - Conditionals and Booleans
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<h1>
<?= 'Hello World' ?>
</h1>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<h1>
<?php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<h1>
<?php
@JeffreyWay
JeffreyWay / AddMemberModal.vue
Last active November 17, 2022 08:10
Learn Vue 3: Step By Step, Episode 30 - Teleporting - https://laracasts.com/series/learn-vue-3-step-by-step/episodes/30
<script setup>
import Modal from "@/Components/Modal.vue";
import {useTeamStore} from "@/stores/TeamStore";
import { ref } from "vue";
let showModal = ref(false);
let team = useTeamStore();
</script>
<template>