Skip to content

Instantly share code, notes, and snippets.

View elmpp's full-sized avatar
💭
In the vortex between paid and indie development

matt penrice elmpp

💭
In the vortex between paid and indie development
  • https://twitter.com/elmpp
  • Amsterdam
  • X @elmpp
View GitHub Profile
@elmpp
elmpp / styled-system.d.ts
Created June 13, 2019 09:46
styled-system typescript definitions updated
/**
* to augment missing styled-system types. @see here - https://tinyurl.com/y5e4bl3f
*/
// "wipe over" the existing module definitions in @types/styled-system with this declare
declare module "styled-system" {
// Type definitions for styled-system 4.2
// Project: https://github.com/jxnblk/styled-system#readme
@elmpp
elmpp / stdout-monkeypatch.ts
Created November 14, 2020 09:58
Monkey patch process.stdout to allow file logging (disappearing streams anyone?)
var origWrite = process.stdout.write;
function monkey(callback){
// callback = callback).function || function(){ };
return ({
patch : function(cb){
var self = this;
this.state = { patched : true };
@elmpp
elmpp / next-recurse.ts
Last active March 24, 2020 14:20
Next item or first of array
/**
Will find the next/prev element from an array based on given element. Will loop back to first/last if given step value exceeds
the bounds of the items
@remarks
{@link https://tinyurl.com/r3nhday | GH Gist url}
@example
```ts
@elmpp
elmpp / gist:5e44255ca75db8083af2fda186869187
Last active November 29, 2018 18:59
Jest: Mocking And Spying On A Class Dependency
// https://bambielli.com/til/2018-01-07-mocking-constructors/
const stackDriverSpy = jest.fn(() => ({}))
jest.genMockFromModule('@google-cloud/logging-winston')
jest.mock('@google-cloud/logging-winston')
const winstonLoggingModule = require('@google-cloud/logging-winston')
winstonLoggingModule.mockImplementation(stackDriverSpy)
@elmpp
elmpp / cloudSettings
Last active November 24, 2017 19:02
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-11-24T17:25:27.366Z","extensionVersion":"v2.8.6"}
/**
* $args example:
* array(3) {
[0]=>
string(15) "wiremock:record"
["feed"]=>
string(5) "CORAL"
["background"]=>
bool(true)
}