Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Jeff Dickey jdxcode

👋
View GitHub Profile
@jdxcode
jdxcode / nd.go
Last active Sep 28, 2018
nd pseudocode
View nd.go
package lib
import "path/filepath"
type Project struct {
Root string
YarnLock interface{}
PackageLock interface{}
Dependencies []*Dependency
@jdxcode
jdxcode / get-all-github-status-checks.ts
Last active Jul 13, 2019
a set of scripts to migrate github status checks from legacy travis to github app (run with ts-node)
View get-all-github-status-checks.ts
// run this second
import GitHub from '@octokit/rest'
import * as _ from 'lodash'
import * as fs from 'fs-extra'
import pMap from 'p-map'
import repos from '../repos.json'
let statuses: {[repo: string]: string[]}
@jdxcode
jdxcode / client.go
Last active Mar 28, 2021
basic IPC example connecting node and golang together with unix socket (named pipe)
View client.go
package main
import (
"io"
"log"
"net"
"time"
)
func reader(r io.Reader) {
@jdxcode
jdxcode / add-user.js
Created Aug 22, 2018
add npm users to org members
View add-user.js
#!/usr/bin/env node
const Client = require('npm-registry-client')
const reg = new Client()
const uri = 'https://registry.npmjs.org/npm'
const csv = require('csv')
const fs = require('fs')
const PARAMS = {auth: {token: process.env.NPM_PASS}, org: 'heroku'}
csv.parse(fs.readFileSync('users.csv'), (err, csv) => {
View heroku-commands.json
[
{
"id": "debug",
"description": "Outputs debugging info\n",
"pluginName": "heroku-debug",
"pluginType": "user",
"hidden": false,
"aliases": [],
"flags": {},
"args": []
View gist:1d7a120f16a8478e77558ca21a451e27
yarn run v1.5.1
$ make
Producer
✓ required methods
✓ should create producer with default options
View global.d.ts
declare namespace NodeJS {
interface Global {
'my-object': {
errlog?: string
debug?: boolean
context?: any
}
}
}
View stars.ts
import {Command} from '@oclif/command'
import axios from 'axios'
export default class Stars extends Command {
static description = 'show the github stars on a repository'
static args = [{name: 'repository', required: true}]
async run() {
const {args} = this.parse(Stars)
const {data: stargazers} = await axios.get(`https://api.github.com/repos/${args.repository}/stargazers`)
for (let s of stargazers) {
@jdxcode
jdxcode / test.ts
Last active Mar 1, 2018
parse override
View test.ts
protected parse<F, A extends {[name: string]: any}>(options: Parser.Input<F>, argv = this.argv): Parser.Output<F, A> {
const {flags, args, strict} = options
return require('@oclif/parser').parse(argv, {context: this, flags, args, strict})
}