Skip to content

Instantly share code, notes, and snippets.

View imranismail's full-sized avatar

Imran Ismail imranismail

View GitHub Profile
@imranismail
imranismail / ssz_data_manager_observer.js
Last active January 20, 2020 23:51 — forked from syaifulsz/ssz_data_manager_observer.js
Simple ES Javascript Plugin for Data Manager & Observer (Single state of truth)
class DataManager {
_listeners = [];
constructor(initialData) {
this._data = initialData;
}
dispatch = (data) => {
this._data = data;
@imranismail
imranismail / how-to-set-up-stress-free-ssl-on-os-x.md
Created September 30, 2017 10:40 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
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
imranismail / service-workers.md
Created November 18, 2016 08:25 — forked from Rich-Harris/service-workers.md
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 twitter.com/rich_harris.

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.

@imranismail
imranismail / docker-compose.yml
Last active October 27, 2016 18:52 — forked from ahmadshah/docker-compose.yml
elixir docker
version: '2'
services:
db:
image: mariadb
restart: always
volumes:
- ./docker/data/mysql:/var/lib/mysql
ports:
- "3306:3306"
@imranismail
imranismail / README.md
Created August 25, 2016 18:59 — forked from ahmadshah/README.md
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.

Example

MyApp.Repo.get(MyApp.User, 1) //will return nil if record is in soft delete state
@imranismail
imranismail / 0_reuse_code.js
Created February 18, 2016 10:32
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#Insall Ajenti
apt-get update
wget http://repo.ajenti.org/debian/key -O- | apt-key add -
echo "deb http://repo.ajenti.org/ng/debian 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*