Skip to content

Instantly share code, notes, and snippets.

View ahgood's full-sized avatar

Guojun ahgood

  • Fullstack Developer
  • Halifax
View GitHub Profile
@DenisJunio
DenisJunio / install_php_8_1.sh
Last active April 15, 2024 02:27
Laravel - PHP 8.1 Extensions - Ubuntu
#!/bin/bash
sudo apt install software-properties-common && sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt upgrade -y
sudo apt install php8.1 -y
sudo apt install php8.1-bcmath -y
sudo apt install php8.1-bz2 -y
sudo apt install php8.1-cli -y
sudo apt install php8.1-common -y
sudo apt install php8.1-curl -y
@JeffreyWay
JeffreyWay / Song.vue
Created September 7, 2021 20:09
Simple Real-Time Search Highlighting Example
<template>
<div>
<form>
<input
@input="setSearch($event.target.value)"
:value="search"
type="text"
placeholder="Search"
class="border p-1"
/>
@alfg
alfg / README.md
Last active February 16, 2024 08:34
MP4 Parser example in Go.

Minimal MP4 Parser Example

  • Download MP4: https://github.com/alfg/mp4/blob/master/test/tears-of-steel.mp4?raw=true
  • Run
go run mp4_example.go tears-of-steel.mp4

go run mp4_example_2.go tears-of-steel.mp4
@BinaryMuse
BinaryMuse / README.md
Last active July 6, 2023 19:02 — forked from fafnirical/change-photo.md
Change your profile photo for all meetup groups

I haven't found a way to set your main profile photo on meetup.com such that it overrides any old photos you have set in individual groups. This script will do just that — set your group specific profile photo to your main photo for every group you're in.

Here's what to do:

  1. Go to your main profile page: http://www.meetup.com/profile/
  2. Ensure you've set your main profile photo to the photo you want to use in all your groups.
  3. Open your browser's developer tools (often F12 on Windows, cmd+opt+i on macOS), copy the following code, paste it in the Console tab, and press enter:
(async function() {
@mjackson
mjackson / toggle-desktop-icons.sh
Last active February 18, 2024 21:15
Quickly show/hide desktop icons on macos
#!/bin/bash
# To install: just copy this script to your machine and name it whatever you want.
# Let's say you named it toggle-desktop-icons.sh, then all you need to do is make
# the script executable, like this:
#
# chmod +x toggle-desktop-icons.sh
#
# Now you can execute the script directly in the terminal any time you want to
# show/hide the desktop icons, like this:
@sebmarkbage
sebmarkbage / WhyReact.md
Created September 4, 2019 20:33
Why is React doing this?

I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.

I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.

"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr

@FlorianRappl
FlorianRappl / useCarousel.ts
Last active March 27, 2024 13:58
The generic useCarousel hook.
import { useReducer, useEffect } from 'react';
import { useSwipeable, SwipeableHandlers, EventData } from 'react-swipeable';
function previous(length: number, current: number) {
return (current - 1 + length) % length;
}
function next(length: number, current: number) {
return (current + 1) % length;
}
type Message = {
id: number;
body: string;
}
type State = {
messages: Message[]
}
const messages: Message[] = [
@kfatehi
kfatehi / gist:07bdef95c132215598a23caf4ce7c2f5
Created January 6, 2019 03:02
hls to icecast with ffmpeg
set -exuo pipefail
LIVESTREAM_URL=$1
if [[ ! $# -eq 1 ]]; then
echo "usage: $0 <URL>"
exit 1
fi
# Referencing FFMpeg to Icecast2 Streaming Sample Gist: https://gist.github.com/keiya/c8a5cbd4fe2594ddbb3390d9cf7dcac9
URL=$(streamlink $LIVESTREAM_URL worst --stream-url)
channels=2
import React, { Suspense, useState } from "react";
import { unstable_createResource as createResource } from "react-cache";
import {
Autocomplete as Combobox,
Input as ComboboxInput,
List as ComboboxList,
Option as ComboboxOption
} from "./Combobox";
function App({ tabIndex, navigate }) {