Skip to content

Instantly share code, notes, and snippets.


Jasim A Basheer jasim

View GitHub Profile
jasim /
Created Mar 3, 2021
JavaScript CSS PostCSS Source-to-Source Compilers

The JavaScript CSS Mess

CSS is simple: you have a .css file, you include it in your HTML, and all the styling gets applied to it.

However: CSS evolves rapidly and browsers often can’t keep up..


For example the current box-shadow property was first implemented only in Chrome, and that property was called -webkit-box-shadow. This is a convention that browser vendors follow when they implement their own browser-specific CSS properties.

jasim / todo_cli_coronasafe.js
Created Jan 30, 2021
A possible solution for the CoronaSafe Fellowship Todo CLI application
View todo_cli_coronasafe.js
const EOL = require('os').EOL
const fs = require('fs')
const PENDING_TODOS_FILE = 'todo.txt'
const COMPLETED_TODOS_FILE = 'done.txt'
View ar_sample_impl.rb
# To execute:
# ruby ar_sample_impl.rb
require 'pp'
class ActiveRecord
class Migration
# See original implementation of `create_table` in ActiveRecord:
def self.create_table(table_name)
View array_filter_map.rb
# Two alternative approaches for
todos = [
["Send invoice", "money"],
["Clean room", "organize"],
["Pay rent", "money"],
["Arrange books", "organize"],
["Pay taxes", "money"],
["Buy groceries", "food"]
View hammerspoon-shiftit.lua
-- to be used in init.lua
-- based on
-- replicates ShiftIt functionality
function setScreenPrimary()
local currentScreen = hs.screen.mainScreen()
function moveToNextScreen()
jasim /
Created May 12, 2020 — forked from jcsherin/
Your Server as a Function
  • Side by side terminology of Future and JS Promises to show similarity. This could be setup earlier when Futures abstraction is introduced. The code examples can then instead use JS Promises which should be familiar to frontend programmers.
  • References to Finagle are ad-hoc at best in the current draft. Make it clear to the reader how Finagle is relevant to the paper under discussion, and the goals of the project.
  • Fix signature difference between Future.t and Js.Promise.t in code examples
  • Add an introduction section which sets the context for this narrative. Building a modern web framework which can apply the principles used in building Finagle. Such a web framework written a statically typed language can provide safety guarantees at compile time. The functional style emphasizing immutability, composition, isolation of side effects etc improves our ability to reason about behaviour.
  • Rewrite conclusion section.
  • Include accidental vs essential complexity quote from out of the
jasim /
Created Jul 22, 2018
A simple bs-express demo with a few custom bindings
/* This example demonstrates how to use bs-express to receive a Json POST request and emit a Json response. */
let myJsonHandler = incoming =>
/* This is the application-level request handler. It is a pure function that takes a string and returns a Json.
In this example, Express doesn't parse the incoming string. We leave it to the application handler so that it has
more control (deal with parsing errors in its own way for example)
incoming |> Json.parseOrRaise |> MyApplication.doSomething;
open Express;
jasim /
Created Aug 12, 2017
Reason script to traverse a native JSON object
type json = Js.Json.t;
let x: json = [%bs.raw {|{"a": [1, "hello", 2, {"b": {"c": [100,200, "d", [10,20,30]]}}]}|}];
let rec json_to_string json => {
let array_to_string a => a |> Array.to_list |> String.concat ",";
let emitObject o =>
"{" ^
let emitKV (key, value) => key ^ ": " ^ json_to_string value;
jasim /
Last active Sep 18, 2016 — forked from gsg/
type instruction =
| Order of {id: int; price: float; size: int}
| Cancel of {id: int}
| Cancel_replace of {id: int; new_price: float; new_size: int}
let filter_by_oid instructions oid =
List.filter (function = oid
) instructions