Skip to content

Instantly share code, notes, and snippets.

View tmarshall's full-sized avatar

Tim Marshall tmarshall

  • Austin / Brooklyn
View GitHub Profile
@kevinSuttle
kevinSuttle / meta-tags.md
Last active July 10, 2024 09:39 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@roberto-butti
roberto-butti / gist:3509401
Created August 29, 2012 09:50
Snippet PHP , how to add product in cart and create order in Magento via SOAP API v1
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$config=array();
$config["hostname"] = "my-hostname-with-magento.com";
$config["login"] = "soapuser";
$config["password"] = "soappassword";
$config["customer_as_guest"] = TRUE;
$config["customer_id"] = 261; //only if you don't want as Guest
@rxaviers
rxaviers / gist:7360908
Last active July 22, 2024 11:10
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@chanks
chanks / gist:7585810
Last active July 19, 2024 10:16
Turning PostgreSQL into a queue serving 10,000 jobs per second

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@joshdover
joshdover / README.md
Last active September 28, 2023 21:38
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

@jhludwig
jhludwig / Dockerfile
Last active September 8, 2016 19:14
Dockerfile for FAIR Deepmask
# Surround.io Deepmask Dockerfile
FROM debian:jessie
ENV PATH /usr/local/cuda/bin:/usr/local/nvidia/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Without this, debconf can ask you interactive questions.
ENV DEBIAN_FRONTEND noninteractive
# Add the Debian backports repo so we can get newer packages.
@tmarshall
tmarshall / lazy-template-literals.js
Last active October 29, 2023 11:21
Lazy javascript template literals
const templatized = (template, vars = {}) => {
const handler = new Function('vars', [
'const tagged = ( ' + Object.keys(vars).join(', ') + ' ) =>',
'`' + template + '`',
'return tagged(...Object.values(vars))'
].join('\n'))
return handler(vars)
}