Skip to content

Instantly share code, notes, and snippets.

@ClosetMonkey
ClosetMonkey / react_forking_experiment.php
Last active Aug 4, 2022
(hackish) ReactPHP experiment for forking within PHP
View react_forking_experiment.php
<?php
require __DIR__ . '/vendor/autoload.php';
pcntl_async_signals(true);
$parent = function($child_monitor_pid)
{ $zmq_context = new ZMQContext();
$parent_loop = new React\EventLoop\ZMQPollLoop();
View MacOS Sierra - Custom PHP Compiled from Source with Threading and Custom ODBC Support.md

I recently got a new Macbook Pro and wanted to document how I setup my PHP environment. I like full control of how PHP is built and I usually build it from source. I do this because I often add custom extensions and modules not found in the common PHP OSX installers. If your looking for a easier method than building from source try https://php-osx.liip.ch/.

NOTE: This post assumes you are running a fresh install of MacOS Sierra 10.12.16 with System Integrity Protection disabled. If you don't know how to disable it just boot into recovery mode and open a terminal and type csrutil disable, or google search it :) This post also assumes you are using Zsh instead of Bash shell. If you are using Bash you can replace anytime you see ~/.zshrc with ~/.bashrc.

First lets get some of the prerequisites. Start by grabbing the command line tools neccessary:

xcode-select --install
View distributed-mediasoup.js
onServerStartup () {
const { serverId, ip } = getServerInfo() // serverId does not change across restarts
this.serverId = serverId
// We don't have any routers or producers (yet). Clear any value that exists in the DB related to our serverId
clearSharedDB(serverId, 'routers')
clearSharedDB(serverId, 'producers')
// Update the DB with our serverId and ip so that others will know how to reach us
registerServerInDB(serverId, ip)
View server.js
const mediasoup = require('mediasoup');
const socketIO = require('socket.io');
const express = require('express');
let socketServer;
let producer;
let worker;
let router;
@ClosetMonkey
ClosetMonkey / index.html
Last active Oct 19, 2021
Submit Button (Anime.js)
View index.html
<!--
https://codepen.io/andrewmillen/pen/MoKLob
-->
<link href="https://fonts.googleapis.com/css?family=Poppins:600" rel="stylesheet">
<main>
<div class="button">
<div class="text">Submit</div>
</div>
@ClosetMonkey
ClosetMonkey / index.html
Last active Oct 19, 2021
Interactive Credit Card
View index.html
<!--
https://codepen.io/andrewmillen/pen/QBObNG
-->
<div class="content-wrapper">
<div class="tilt">
<div class="credit-card">
<div class="credit-card__front">
<div class="circle circle-1"></div>
<div class="circle circle-2"></div>
View anime-js-scrollmagic-scroll-based-animations.markdown

Anime.js + ScrollMagic Scroll Based Animations

A example of using ScrollMagic to trigger Anime.js animations. Some of the animations are set to play when triggered and some are set to progress as the user scrolls the page.

A Pen by Rex Bullington on CodePen.

License.

@ClosetMonkey
ClosetMonkey / index.html
Created Oct 19, 2021
Porduct delivery status card for website
View index.html
<body>
<div class="container">
<div class="iphone">
<div class="header">
<div class="order-summary">
<div class="order-status">Arriving date</div>
<div class="order-date">
19 Sept, 2021
</div>