Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cthurston's full-sized avatar

Christopher Thurston cthurston

View GitHub Profile
@cthurston
cthurston / format_phone_number.sql
Last active August 6, 2019 06:57
A postgres function that attempts to format phone number to RFC 3966
CREATE OR REPLACE FUNCTION "public"."format_phone_number"(text)
RETURNS "pg_catalog"."text" AS $BODY$
BEGIN
RETURN
regexp_replace(
regexp_replace(
regexp_replace(
regexp_replace(
regexp_replace(
regexp_replace(
@cthurston
cthurston / ffmpeg_build.sh
Created August 2, 2019 16:45 — forked from billyshambrook/ffmpeg_build.sh
Build FFMPEG, x264 and FDK-AAC
sudo apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev yasm
sudo apt-get update
sudo apt-get -y install autoconf automake build-essential checkinstall git libass-dev \
libgpac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libspeex-dev \
libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev
cd
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
@cthurston
cthurston / react-datasheet-virtualized.jsx
Created February 24, 2018 03:20
React-Datasheet with React-Virtualized
// DataSheet.js
render() {
const { sheetRenderer: SheetRenderer, rowRenderer: RowRenderer, cellRenderer,
dataRenderer, valueRenderer, dataEditor, valueViewer, attributesRenderer,
className, overflow, data, keyFn } = this.props
const { forceEdit } = this.state
return (
<span ref={ r => { this.dgDom = r } } tabIndex='0' className='data-grid-container' onKeyDown={ this.handleKey }>
@cthurston
cthurston / mongodb-facet-combine.js
Created November 3, 2017 14:21
MongoDb combine $facet results into a single result set.
db.getCollection('list').aggregate([
{
$facet: {
"events":[{
$match: {
'type': 'Event'
}
}],
"tasks": [{
$match: {