Skip to content

Instantly share code, notes, and snippets.

View susanBuck's full-sized avatar

Susan Buck susanBuck

View GitHub Profile
@susanBuck
susanBuck / readings.md
Created January 31, 2022 22:50
e15 Readings
<?php
namespace App\Controllers;
class AppController extends Controller
{
/**
*
*/
public function index()
@susanBuck
susanBuck / AppController.php
Created December 12, 2021 04:20
game method
<?php
public function game()
{
# Initialize variables
$goal = 25;
$playerSum = 0;
$playerTurns = []; # We'll use this array to store the player's points and sum for each turn
$opponentSum = 0;
$opponentTurns = []; # We'll use this array to store the opponent's points and sum for each turn
@susanBuck
susanBuck / swap-file.md
Created November 15, 2021 20:43
Swap file

In this note set we’ll configure our low-memory DigitalOcean droplets to use a swap file, which will help optimize it for memory-intensive tasks.

"Swap is an area on a hard drive that has been designated as a place where the operating system can temporarily store data that it can no longer hold in RAM." -ref

To configure a swap file, run through the following commands.

First, create the swap file:

$ sudo fallocate -l 4G /swapfile
@susanBuck
susanBuck / process.php
Created October 28, 2021 01:16
Example
<?php
$player_move = $_POST['userPick'];
$computer_move = ['Rock', 'Paper', 'Scissors'][rand(0, 2)];
$win = check_moves($player_move, $computer_move);
function check_moves($player, $computer)
{
@susanBuck
susanBuck / index-view.php
Created October 13, 2021 18:55
Slap Jack example
<h2>Results</h2>
<p>The winner of the game was <?php echo $overallWinner; ?>!
Below is the results of each round.</p>
<?php foreach ($results as $roundNumber => $data) { ?>
<ul>
<li>Round #: <?php echo $roundNumber ?>
</li>
<li>Player A discarded: <?php echo $data['playerADiscard']; ?>
@susanBuck
susanBuck / gist:d08adbb495ae75779d2af5732d061d7c
Created October 3, 2021 19:19
Endless war game example
Round: 1
Player 1 card count: 27
Player 2 card count: 25
Player 1 card: 13
Player 2 card: 4
Winner: Player 1
Round: 2
Player 1 card count: 28
@susanBuck
susanBuck / .zshrc
Last active September 14, 2021 14:20
.zshrc example
# ------------------------------------
# MOTD (Message of the Day)
# What you see when Terminal opens
# ------------------------------------
echo "----------------------------"
echo "Loaded config: ~/.zshrc"
echo ""
echo "To edit run: configedit"
echo "To refresh run: configrefresh"
@susanBuck
susanBuck / LoginAs.vue
Created April 27, 2021 00:49
LoginAs.vue
<template>
<div>
<p>Login as: {{ id }}</p>
<p>Response: {{ response }}</p>
</div>
</template>
<script>
import { axios } from "@/common/app.js";
@susanBuck
susanBuck / router.js
Last active May 5, 2021 15:52
ZipFoods router.js
import { createRouter, createWebHistory } from 'vue-router';
import { store } from '@/common/store';
// Define all the routes of our application
const routes = [
{
path: '/',
// Rather than having to have separate import statements at the top of this page for each component
// Here’s a simple way we can directly make our components available
component: () => import('@/components/pages/HomePage.vue'),