Skip to content

Instantly share code, notes, and snippets.

View hopeseekr's full-sized avatar

Theodore R. Smith hopeseekr

View GitHub Profile
@hopeseekr
hopeseekr / index.html
Created March 11, 2020 15:41 — forked from tiffany352/index.html
Twitter archive browser
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Twitter Archive Browser</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
<style>
@hopeseekr
hopeseekr / phones.js
Created October 3, 2019 00:48
Formatting phones
phone: {
get: function() {
return this.value;
},
// setter
set: function(newValue) {
if (newValue.length === 1) {
this.value = "(" + newValue;
} else if (newValue.length === 4) {
this.value = newValue + ") ";
@hopeseekr
hopeseekr / README.md
Created June 13, 2019 07:18
DTOs in Action: The ColorSpeaker Project

ColorSpeaker was inspired by the article Tests and types [mirror] that was posted to /r/PHP two days ago.

Its aim is to be an easy-to-use converter for different types of color models (RGB, CSS hex codes, HSV, HSL, etc.). It is also meant to be a real-world example of the power of Data Transfer Objects (DTOs). I specifically created this for one of my apprentices whom I taught DTOs to the night before I read the above article, and thought this would be a perfect project for showcasing DTOs.

I developed it in three distinct iterations:

  1. [v0.25 tag]: A virtually literal implementation of the article's one color DTO (RGBSpeaker and RGBColor). This is a great place to start learning about DTOs and is meant to be used in conjunction with the article that inspired it.
  2. **[[v0.50](https://github.c
@hopeseekr
hopeseekr / fractal-20190611.txt
Created June 12, 2019 14:57
A beautiful ASCIII fractal
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x A A A A A A A x x x x x x x x x x x x
x x x x x x x x x x x x A A A A A A A A A A A A A A x x x x x x x x x x x
x x x x x x x x x x x v v A A A A A A A A A v v x x x x x x x x x x x
x x x x x x x x x x x v A A A A A A A A A A A A v x x x x x x x x x x
x x x x x x x x x x A A A A A A A A A A A A A A A x x x x x x x x x x
x x x x x x x x x x v v v v v A A A A A A v v v v v x x x x x x x x x
x x x x x x x x x v v v v A A A A A A A A A v v v v x x x x x x x x x
x x x x x x x x x v v v A A A A A A A A A A A A v v v x x x x x x x x
x x x x x x x x v v v v v v A A A A A A A A A v v v v v v x x x x x x x x
@hopeseekr
hopeseekr / gem.txt
Created May 29, 2019 12:32
A Hidden Gem
xgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgxgx
gxgoyxgoyxgoyxgoyxgxyogxyogxyogxyogxyogxyogxyogxyogxyogxyogxyogxyogxg
xgoyxgoyxgoyxgoyxgoycccycccycccycccycccycccycccycccyogxyogxyogxyogxyx
goyxgoyxgoyxgoyxgoycccysgcysgcysgcysgcysgcysgcysgcccgxyogxyogxyogxyog
xyxgoyxgoyxgoyxgoycgsycccysgsycccysgsycccysgsycccysgcyogxyogxyogxyogx
gxgoyxgoyxgoyxgoycccycccysgsysgcysgsysgcysgsysgcccgcccgxyogxyogxyogxg
xgoyxgoyxgoyxgoycgsysgsycccycccysgsysgsycccycccysgsysgcyogxyogxyogxyx
goyxgoyxgoyxgoycccysgsycccysgcysgsysgsysgcysgcccgsysgcccgxyogxyogxyog
xyxgoyxgoyxgoycgsycgsycgsycccysgsysgsysgsycccysgcysgcysgcyogxyogxyogx
gxgoyxgoyxgoycccycccycccycccysgsysgsysgsysgcccgcccgcccgcccgxyogxyogxg
<?php
function asdf()
{
function asd() { echo "Hi\n"; }
asd();
}
asdf();
asd();
@hopeseekr
hopeseekr / howto_git_submodules.sh
Created March 19, 2019 17:04
HOWTO Split Huge Subdirectories into Git Submodules
# First, split the huge directory into its own standalone branch.
git subtree split -P v1/fpdf/assets/img -b api_fpdf_asset_images
# Second, push the huge directory into its own repository.
pushd ..
mkdir api_fpdf_asset_images
pushd api_fpdf_asset_images
git init
git pull ../api.filtered api_fpdf_asset_images
@hopeseekr
hopeseekr / README.md
Created March 14, 2019 17:13
Real-World Continuous Integration

Real-World Continuous Integration

What is Continuous Integration (CI)?

Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. 

Here are the basic parts of a modern CI system:

  1. Automated Tests:
@hopeseekr
hopeseekr / strategy_pattern_tutorial.php
Created March 13, 2019 21:42
Strategy Pattern Educational Code
<?php
interface RESTAuthDriver
{
public function setApiClient(RESTSpeaker $apiClient);
public function generateGuzzleAuthOptions(): array;
}
interface Foo2
{
@hopeseekr
hopeseekr / 911s_a_lie.md
Created June 27, 2018 13:40
9/11's a Lie! Lyrics

Lyrics to Deek Jackson's "9/11's a Lie!"

If you think 9/11 was an inside job
You're probably right, but who gives a fuck?
The world moved on and the truth don't count.
If you don't believe me, Take a look about:
At the tyranny in China, for a billion souls;
Economic crisis, adding to our woes!
The economic lies are there to fool the masses,

While they bend us over, and fuck us in our asses!