Skip to content

Instantly share code, notes, and snippets.

View bdurrani's full-sized avatar
:octocat:
Computering all the things

Bilal Durrani bdurrani

:octocat:
Computering all the things
View GitHub Profile
@bdurrani
bdurrani / curry-record.md
Created September 18, 2019 16:48 — forked from timhwang21/curry-record.md
Curry unary functions that take a record as an argument

curryRecord

This is an example of a function whose logic lives in the type definition rather than in the function body.

/**
 * @name `curryRecord`
 *
 * Takes a unary function that takes a record as an argument, and makes the
 * record partially applicable. Returns a new function that takes a partial of
@bdurrani
bdurrani / README.md
Created August 26, 2019 16:59 — forked from boneskull/README.md
example of how to debug mocha v4 if hanging

Here's an example of how to debug Mocha v4 if it hangs.

Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).

If you run your test, you'll notice it hangs:

$ mocha test.js
@bdurrani
bdurrani / commands
Last active August 17, 2019 21:30
pgAdmin and postgres docker compose
docker run --rm --volumes-from postgres_container -v C:\deletethis\postgres\:/backup ubuntu tar cvf /backup/backup.tar /var/lib/postgresql/data
One way to persist data is to use a custom volume
https://stackoverflow.com/questions/41637505/how-to-persist-data-in-a-dockerized-postgres-database-using-volumes
```
docker volume create pgdata
docker run -p 5432:5432 -v pgdata:/var/lib/postgresql/data --name postgres_container --network postgres-docker_postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password --volumes-from=data-container postgres
@bdurrani
bdurrani / Chain.js
Last active March 28, 2018 19:48
Iterator helper, based on wu.js. Lets you use filter/map/reduce with an iterator
/**
* This is the iterator, becusae it implements the iterator protocol
* Iterator protocol requires an object that implements next() with certain semantics
*/
class Chain {
constructor(iterable) {
this.iterator = Chain.getIterator(iterable);
}
next() {
@bdurrani
bdurrani / boxstarter.ps1
Last active February 4, 2018 18:57 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@bdurrani
bdurrani / parsebytecode.fs
Last active September 25, 2015 14:26
Parse the output of objdump -d -M intel and print out the byte code as an array of hex bytes
open System
open System.Diagnostics
open System.Globalization
let inline flip f x y = f y x
let parseLine(input:string) =
let trimmed = input.Trim()
if String.IsNullOrWhiteSpace trimmed || (trimmed.Contains("\t") |> not) then
Array.create 0 ""