Skip to content

Instantly share code, notes, and snippets.

@zahid
zahid / writing-invent.md
Last active January 29, 2017 02:37
Writing Invent

invent

Recently, I've been wanting to get more involved with open source, or more accurately, start actually contributing to it. My initial idea was to build a tool that could be quickly cloned via git and used as a base setup for someone who doesn't know how to use Vagrant. This was initially something I called angry-hobo, it worked for a little while, but was a great mess. It didn't work quite right in my opinion.

Here's a list of things that needed improvement:

  • angry-hobo cloned a scaffold vs generated a scaffold
  • angry-hobo left .git artifacts after cloning which required to be cleaned
  • angry-hobo included the Chef cookbooks in the repo, which I later opted against
@zahid
zahid / Dockerfile
Last active April 24, 2018 14:16
Using Docker to virtualize your development environment
# To build this image:
# docker build -t app .
#
# To run this image as a container:
# docker run --name app --rm -it app
FROM node:6
RUN npm install --global pm2
@zahid
zahid / facts.md
Last active January 5, 2017 04:26
Brittney's random fact application

User stories

  • Continuous integration
    • build image when code is updated
    • deploy image to server
    • restart application
  • Make font easier to read
  • Put GA so I can see what's happening
  • 100 more facts
  • 100 more background images
@zahid
zahid / nodejs-application-pattern.md
Last active December 29, 2016 03:25
nodejs application pattern

Description

Build an API with NodeJS with a great, small framework.

This is the NodeJS application pattern.

Quickstart

  1. Install dependencies using npm install
@zahid
zahid / docker-compose.yml
Created November 2, 2016 19:21
A docker-compose setup for the jboss/drools-workbench-showcase and the jboss/kie-server-showcase images
version: '2'
services:
drools-wb:
container_name: drools-wb
image: jboss/drools-workbench-showcase:6.4.0.Final
ports:
- 8001:8001
- 18080:8080
@zahid
zahid / question.js
Created October 24, 2016 13:32
So a list of things walk into a bar . . .
// TODO: turn this into a "three guys walk into a bar" joke....
/*
You have a list of things you need process, items. In our case, times in seconds.
Use "processItemAsynchronously(timeInMilliseconds)" on each item in "items", while processing the items one at a time.
Each item completes in random time, asynchronously.
@zahid
zahid / question.js
Created October 24, 2016 13:32
So a list of things walk into a bar . . .
// TODO: turn this into a "three guys walk into a bar" joke....
/*
You have a list of things you need process, items. In our case, times in seconds.
Use "processItemAsynchronously(timeInMilliseconds)" on each item in "items", while processing the items one at a time.
Each item completes in random time, asynchronously.
@zahid
zahid / twoLetterCommands.sh
Created June 5, 2015 13:07
Find all two letter commands on $PATH
( IFS=:;
for p in $PATH; do
ls "$p" | egrep -x '.{2}' ;
done; )
@zahid
zahid / sevenify.js
Created March 27, 2014 05:33
Sevenify Problem
/* This is my implementation of the problem regarding replacing the element in the row and column of each instance of a 7 with 7s. I did this without allocating extra memory by just keeping track of the rows and columns that needed to be 'sevenified' and I did it in the end in one pass, therefore not having to rewrite 7s over and over again. My efficiency for sevenify's element reassignment, at the worst case, is O(m+n) or O((m+n) + (m*n)) if you include the cycles to create the locations hash.
I would test this by checking that:
- clone works properly (I tested to check for deep copying)
- test fillRow (and fillColumn) work on a single row (and column) with no 7s present
- test fillRow (and fillColumn) work on a single row (and column) with one 7 present
- test fillRow (and fillColumn) work on a single row (and column) with all elements set to 7
zahid mahir