Skip to content

Instantly share code, notes, and snippets.

View mrfoh's full-sized avatar

Patrick Foh Jr mrfoh

View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@qiao
qiao / ip.js
Created January 17, 2012 11:27
Node.js get client IP address
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address
function getClientIp(req) {
var ipAddress;
// The request may be forwarded from local web server.
var forwardedIpsStr = req.header('x-forwarded-for');
if (forwardedIpsStr) {
// 'x-forwarded-for' header may return multiple IP addresses in
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the
// the first one
var forwardedIps = forwardedIpsStr.split(',');
@jonlabelle
jonlabelle / string-utils.js
Last active June 21, 2026 12:40
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();
@SerhiiKozachenko
SerhiiKozachenko / repository.js
Created August 6, 2013 21:54
Mongoose odm and repository pattern.
var mongoose = require('mongoose');
var repository = function (modelName) {
var self = this;
self.Model = require('../models/' + modelName);
self.FindById = function (id, cb) {
self.FindOne({
@logbon72
logbon72 / nigeria_state_polygons.json
Created January 2, 2016 13:12
Coordinate Boundaries for Nigerian States
{
"ABIA": [
[5.3918045732398, 7.3196411132812],
[5.4246168391946, 7.3388671875],
[5.4437565043427, 7.3663330078125],
[5.5285105256928, 7.4020385742188],
[5.6282859838703, 7.4006652832031],
[5.6856833027592, 7.3814392089844],
[5.6952489676056, 7.4020385742188],
[5.8428131655266, 7.3855590820312],
@radrice
radrice / fsAngular.js
Created February 9, 2016 15:41
A quick setup for AngularJS + FullStory
/*
A kludgey example of how to use FullStory with AngularJS.
Just shove it into .run :-)
Do with it as you please, but use at your own risk.
This is not officially sanctioned code and intended to provide an example
of how FullStory is implemented in an Angular application.
*/
(function(){
'use strict';
@lukas-zech-software
lukas-zech-software / GeoCodingService.ts
Last active April 9, 2021 21:56
Typescript Definitions for official GoogleMaps API for Node.js (https://github.com/googlemaps/google-maps-services-js)
import { createClient, GoogleMapsClient } from '@google/maps';
export class GeoCodingService {
private geoCoder: GoogleMapsClient;
public constructor() {
this.geoCoder = createClient({
key: 'YOUR-API-KEY',
});
@asoorm
asoorm / docker-compose-mongo-replicaset.yml
Created September 14, 2018 19:00
Mongo Replica Set docker compose
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
@milesbxf
milesbxf / monzo-alertmanager-config.yaml
Last active May 19, 2026 13:19
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@oneryalcin
oneryalcin / codex-app-server-guide.md
Created April 29, 2026 10:23
Building on codex app-server: a developer's guide to OpenAI Codex's JSON-RPC interface (transports, methods, hooks, subagents, skills, MCP, Python SDKs, reference architecture, recipes)

Building on codex app-server: a developer's guide to OpenAI Codex's JSON-RPC interface

Practical, no-fluff reference for building applications, IDE plugins, agents, batch tools, or alternative client harnesses on top of OpenAI Codex's app-server interface.

This guide distills:

  • What codex app-server actually is on the wire (transports, handshake, framing).
  • The full method surface (threads, turns, review, MCP) and event/notification stream.
  • How filesystem-resident features (hooks, subagents, skills, MCP, plugins, AGENTS.md) interact with the protocol.
  • Where state lives on disk (Codex core state vs. companion state).
  • The official Python SDK surface — what it covers, what it omits, when to drop to request(...).