Skip to content

Instantly share code, notes, and snippets.

View karimsa's full-sized avatar

Karim Alibhai karimsa

View GitHub Profile
/*!
* Bootstrap v2.3.2
*
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world by @mdo and @fat.
*/
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@karimsa
karimsa / ngEnter.js
Last active August 23, 2016 00:07 — forked from EpokK/ngEnter.js
ngEnter directive if you can use submit form(https://twitter.com/ririlepanda)
app.directive('ngEnter', () => ($scope, $elm, $attrs) => {
$elm.bind('keydown keypress', evt => {
if ( evt.which === 13 ) {
$scope.$apply(() => $scope.$eval($attrs.ngEnter));
evt.preventDefault();
}
});
});
/**
* Script to download all comics from xkcd.
*/
'use strict';
const fs = require('fs')
const cheerio = require('cheerio')
const request = require('request')
@karimsa
karimsa / getReceipt.js
Created February 2, 2017 18:33
Algorithm to read basic receipts using OCR response from MS cognitive services. Built for McHacks 2017.
/**
* getReceipt.js - Split
* Logic to convert a JSON response from
* the MS Cognitive Services OCR API into
* proper receiptable data.
*
* Licensed under MIT license.
* Copyright (C) 2017 Karim Alibhai.
*/
@karimsa
karimsa / commit_format_examples.txt
Created March 14, 2018 03:32 — forked from mutewinter/commit_format_examples.txt
Examples of my commit format.
chore: add Oyster build script
docs: explain hat wobble
feat: add beta sequence
fix: remove broken confirmation message
refactor: share logic between 4d3d3d3 and flarhgunnstow
style: convert tabs to spaces
test: ensure Tayne retains clothing
@karimsa
karimsa / about.md
Last active November 14, 2019 00:38
My Talks

About the Speaker (Me)

I'm a Senior Bug Creator which basically means that I get paid to sit behind a desk and create lots of bugs that we sometimes call "features". I've been writing JavaScript for about 10 years now & have loved every second of it. It always amazes me how much extensibility and dynamic behavior JS brings to development.

I'm also an advocate for better DX & love working on tools and processes that can help augment a developer's life. Part of this journey has been learning that building more stable systems is more a product of treating error handling as an art than to do with removing bugs. I've been fortuanate enough to have the opportunity to speak at a few events as well as teach web development before. It's my favourite part of the development life & I love opportunities to share my experiences while learning about experiences from the community.

  • If you want to check out some of my talks or projects, you can visit: https://alibhai.co
  • I occasionally write blo
@karimsa
karimsa / merge.sh
Last active September 6, 2018 16:09
Create a combined branch for deploying multiple branches to a single test environment
#!/bin/sh -ex
## merge.sh
##
## The purpose of this script is to cover the merging of a given list of branches so that
## multiple branches can be deployed to the same test environment in order to test PRs on
## a staging environment before merging the PR.
##
## Licensed under MIT license.
## Copyright (C) Foko Inc. All rights reserved.
@karimsa
karimsa / to-json.js
Created October 1, 2018 16:10
Serialize an ES2015 Map object to a JSON object
/**
* Serialize map to object. Goal is to be able to use 'Map' over object when performing
* large algorithms over a hash map - but then serializing it to an object for sending
* over a wire.
*/
Map.prototype.toJSON = function() {
const o = Object.create(null)
for (const k of this.keys()) {
if (typeof k !== 'string' && typeof k !== 'number') {
@karimsa
karimsa / docker-deploy.sh
Created January 14, 2019 20:09
Deploy private docker image
#!/bin/sh -ex
# docker-deploy.sh
# Deploys image from Travis to ECR.
#
# Copyright (C) 2017-present Karim Alibhai. All rights reserved.
export PROJECT="$(cat .travis.yml | grep 'repo\:' | head -n 1 | cut -d\: -f2 | cut -d/ -f2 | sed 's/^dyn-//')"
if test -z "$TRAVIS_PULL_REQUEST" || test "$TRAVIS_PULL_REQUEST" != "false"; then