Skip to content

Instantly share code, notes, and snippets.

@vrinek
vrinek / in-parallel.fish
Created February 2, 2022 13:51
Fish function to run multiple commands in parallel
argparse "n/name=" "c/commands=+" -- $argv
or return
set n (count $_flag_commands)
tmux has-session -t "$_flag_name"
if test "$status" -eq "0"
echo "tmux session already exists for $_flag_name, maybe still running?"
echo "Try `tmux new -As $_flag_name` to attach to it."
return 1

Keybase proof

I hereby claim:

  • I am vrinek on github.
  • I am vrinek (https://keybase.io/vrinek) on keybase.
  • I have a public key ASCN8yyYMWaUQoDifFldhoS4u8RE6CVQ7YLgYTrdzeh3hwo

To claim this, I am signing this object:

const nock = require('../.');
const test = require('tap').test;
const request = require('request');
test('reqheaders ignored #748 - test matching', t => {
nock('http://www.example.com', {
reqheaders: {
'authorization': 'Bearer TOKEN'
}
})
var http = require('http');
var countdown = 10;
function makeRequest(iteration) {
var t = Date.now();
http.request({
host: 'www.google.com',
path: '/'
}, function(response){
const configureMockStore = require('redux-mock-store').default;
const thunk = require('redux-thunk').default;
const nock = require('../');
const expect = require('expect'); // You can use any testing library
const fetch = require('isomorphic-fetch');
function fetchTodosRequest() {
return {
type: 'FETCH_TODOS_REQUEST'
}
const fetch = require('node-fetch');
const FormData = require('form-data');
const nock = require('../');
const formData = new FormData();
formData.append('test', 'true');
nock('http://localhost')
.post('/api/test')
.reply(function(uri, requestBody) {
@vrinek
vrinek / cleanup.md
Created December 12, 2015 13:02
Monday morning cleanup scripts

Docker

docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs docker rm
docker images | grep '^<none>' | awk '{print $3}' | xargs docker rmi

Rails

@import url("../rust.css");
body {
max-width:none;
}
@media only screen {
#toc {
position: absolute;
left: 0px;
irb(main):065:0> a = "雷"
"雷"
irb(main):066:0> b = a.unpack("C*").pack("C*")
"\xE9\x9B\xB7"
irb(main):067:0> a == b
false
irb(main):068:0> a.bytes == b.bytes
true
irb(main):069:0> a == b.unpack("U*").pack("U*")
true
@vrinek
vrinek / post.md
Last active August 29, 2015 14:13
Ruby 2.2 - Warning: circular argument reference

Ruby 2.2.0 now warns against a circular argument reference. It is pretty simple to demonstrate and pretty difficult to explain so I'll just present some code snippets.

The first example shadows a function (which I have encountered in one of the open-source projects I'm involved with):

def foo
  42
end

def bar(foo = foo)