Skip to content

Instantly share code, notes, and snippets.

Working from Asia

Imran Ismail imranismail

Working from Asia
View GitHub Profile
imranismail / ssz_data_manager_observer.js
Last active Jan 20, 2020 — forked from syaifulsz/ssz_data_manager_observer.js
Simple ES Javascript Plugin for Data Manager & Observer (Single state of truth)
View ssz_data_manager_observer.js
class DataManager {
_listeners = [];
constructor(initialData) {
this._data = initialData;
dispatch = (data) => {
this._data = data;
imranismail /
Created Sep 30, 2017 — forked from jed/
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

imranismail /
Created Nov 18, 2016 — forked from Rich-Harris/
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

View docker-compose.yml
version: '2'
image: mariadb
restart: always
- ./docker/data/mysql:/var/lib/mysql
- "3306:3306"
imranismail /
Created Aug 25, 2016 — forked from ahmadshah/
Ecto Soft Delete

Soft Delete Ecto Repo

The goal is to support soft delete functionality in Ecto.Repo. With the suggestion by @imranismail, another repo is created and the remaining functionalities are delegate to the original MyApp.Repo.

The new repo get/2 and all/1 functions will exclude the soft deleted record by default. delete/1 and delete_all/1 will update the delete_at column by default instead of deleting.


MyApp.Repo.get(MyApp.User, 1) //will return nil if record is in soft delete state
imranismail / 0_reuse_code.js
Created Feb 18, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:73c7bbc52a94ba10b267
#Insall Ajenti
apt-get update
wget -O- | apt-key add -
echo "deb main main ubuntu" >> /etc/apt/sources.list
apt-get update
apt-get install ajenti
service ajenti restart
# Uninstall Apache2
sudo apt-get autoremove && sudo apt-get remove apache2*