Skip to content

Instantly share code, notes, and snippets.

@Soben
Soben / columns.php
Created September 20, 2019 17:20
Special Column Layout
<?php
/*
Purpose of this script is that if the last row is not equal
to the total that we want, we need to update the wrapping
element's classes based on a variety of quantities.
Thanks Tailwind.
*/
$totalCount = 11;
<?php
function nyo_truncate_content ( $content ) {
require_once( AMP__DIR__ . '/includes/utils/class-amp-dom-utils.php' );
$elementsRemaining = 2;
$contentDOM = \AMP_DOM_Utils::get_dom_from_content(apply_filters('the_content', $content) ); // Returns a DOMDocument
$contentDOMParsed = clone $contentDOM;
// Strip all elements from the body.
@Soben
Soben / docker-compose.yml
Created January 15, 2020 19:10
Wordpress Docker Configuration
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
@Soben
Soben / keybase.md
Created February 1, 2020 18:21
keybase.md

Keybase proof

I hereby claim:

  • I am soben on github.
  • I am soben (https://keybase.io/soben) on keybase.
  • I have a public key ASASBe_e67tjizGUVNwQcshXjLQ1p_mPEHQ8CispX9x23Qo

To claim this, I am signing this object:

@Soben
Soben / docker-compose.yml
Created February 18, 2020 20:12
Simple Docker Wordpress
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
@Soben
Soben / passthrough.js
Last active October 12, 2022 20:53
GET Query Passthrough Handling
/**
* Querystring Passthrough
* Allows UTM values to stickaround on the site until needed.
*/
{
const allowedPassthrough = [
"utm_medium",
"utm_source",
"utm_campaign",
"utm_content",
@Soben
Soben / columnFinder.php
Last active August 14, 2023 13:44
Cassidoo | Sheet Column lookup to get true column number from letter structure.
<?php
/*
Solving Cassidoo's coding problem from the newsletter sent February 6th.
Co-Pilot assisted *sigh*
I was on track to solve the problem, but co-pilot immediately spurted out the `pow`
function before I had a chance to figure out the math. I'm not sure if I'm happy or
annoyed. Co-Pilot is also helping me type this message out :|
@Soben
Soben / Dockerfile
Last active February 28, 2023 03:08
fly.io Barebones Apache Configuration for Slim PHP
FROM php:8.2-apache
# Install `zip` -- required for composer
RUN apt update \
&& apt install -y zip libzip-dev \
&& docker-php-ext-configure zip \
&& docker-php-ext-install zip
# Install Apache rewrite module
RUN a2enmod rewrite
@Soben
Soben / README.md
Created August 2, 2023 23:53
Cassidoo | isAnagram

Solution to Cassidoo's Week of July 31, 2023 Challenge

Given two strings s and t, return true if t is an anagram of s, and false otherwise. Try this in a language you're not comfortable with!

Realized there were a couple edge cases, like with anagrams involving differences in several words, but are still valid. Adjusted accordingly.

Never wrote anything in Python before, but besides being able to look up equivalent php functions in python, it was thankfully pretty one-to-one conversion.

@Soben
Soben / README.md
Last active August 14, 2023 13:53
Cassidoo | Faulty Keyboard

Solution to Cassidoo's Week of Aug 14, 2023 Challenge

You have a faulty keyboard. Whenever you type a vowel on it (a,e,i,o,u,y), it reverses the string that you have written, instead of typing the character. Typing other characters works as expected. Given a string, return what will be on the screen after typing with your faulty keyboard.