Skip to content

Instantly share code, notes, and snippets.

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
  • Twitter @elmpp
View GitHub Profile
View gist:0f760a99338f4e016373356f5b2c8493
/**
* $args example:
* array(3) {
[0]=>
string(15) "wiremock:record"
["feed"]=>
string(5) "CORAL"
["background"]=>
bool(true)
}
@elmpp
elmpp / cloudSettings
Last active Nov 24, 2017
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2017-11-24T17:25:27.366Z","extensionVersion":"v2.8.6"}
@elmpp
elmpp / gist:5e44255ca75db8083af2fda186869187
Last active Nov 29, 2018
Jest: Mocking And Spying On A Class Dependency
View gist:5e44255ca75db8083af2fda186869187
// 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 / styled-system.d.ts
Created Jun 13, 2019
styled-system typescript definitions updated
View styled-system.d.ts
/**
* 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 / next-recurse.ts
Last active Mar 24, 2020
Next item or first of array
View next-recurse.ts
/**
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 / stdout-monkeypatch.ts
Created Nov 14, 2020
Monkey patch process.stdout to allow file logging (disappearing streams anyone?)
View stdout-monkeypatch.ts
var origWrite = process.stdout.write;
function monkey(callback){
// callback = callback).function || function(){ };
return ({
patch : function(cb){
var self = this;
this.state = { patched : true };