Skip to content

Instantly share code, notes, and snippets.

View one-aalam's full-sized avatar
🎯
Focusing

Aftab Alam one-aalam

🎯
Focusing
View GitHub Profile
@one-aalam
one-aalam / ink.css
Last active February 28, 2023 08:03
Generic CSS classes for a blog app feat. Tailwind CSS (extracted from Astro Ink)
@tailwind base;
@tailwind components;
/* Generic */
body {
@apply font-sans antialiased min-h-screen;
}
/* Container */
.container {
@one-aalam
one-aalam / JSONSerializable.swift
Created April 14, 2021 00:08
Utility to easily serialise Struct in Swift
//: ### Defining the protocols
protocol JSONRepresentable {
var JSONRepresentation: Any { get }
}
protocol JSONSerializable: JSONRepresentable {}
//: ### Implementing the functionality through protocol extensions
extension JSONSerializable {
var JSONRepresentation: Any {
@one-aalam
one-aalam / gist:3c3f3d02d150f96d31a1976b626753b5
Created July 20, 2020 05:30 — forked from sapegin/gist:1675531
Simple Node.js static HTTP server
function serve(lang, port) {
if (!lang && o.LANGS.length) lang = o.LANGS[0];
if (!port) port = 8000;
var mimeTypes = {
'default': 'text/plain',
'.html': 'text/html',
'.jpg': 'image/jpeg',
'.png': 'image/png',
'.js': 'text/javascript',
'.css': 'text/css'
@one-aalam
one-aalam / handler.js
Created July 20, 2020 05:30 — forked from jeffrafter/handler.js
Simple HTTP Server and Router in node.js
exports.createHandler = function (method) {
return new Handler(method);
}
Handler = function(method) {
this.process = function(req, res) {
params = null;
return method.apply(this, [req, res, params]);
}
}
@one-aalam
one-aalam / machine.js
Created June 22, 2020 03:46
Generated by XState Viz: https://xstate.js.org/viz
const assignmentStates = {
initial: 'with_candidate',
states: {
with_candidate: {
id: 'assignment_with_candidate',
on: {
CANDIDATE_REJECTED: '#assignment_with_candidate',
CANDIDATE_NOT_DOING_ASSIGNMENT: '#discuss_with_business',
CANDIDATE_SUBMITTED_ASSIGNMENT: '#assignment_submitted_by_candidate',
},
@one-aalam
one-aalam / machine.js
Created June 19, 2020 11:09
Generated by XState Viz: https://xstate.js.org/viz
const assignmentStates = {
initial: 'with_candidate',
states: {
with_candidate: {
id: 'assignment_with_candidate',
on: {
CANDIDATE_REJECTED: '#assignment_with_candidate',
CANDIDATE_NOT_DOING_ASSIGNMENT: '#discuss_with_business',
CANDIDATE_SUBMITTED_ASSIGNMENT: '#assignment_submitted_by_candidate',
},
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@one-aalam
one-aalam / rollup.config.js
Created July 21, 2019 05:30 — forked from evdama/rollup.config.js
rollup.config.js for sapper, tailwind and firebase
// @ts-nocheck TODO: remove at some point
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import config from 'sapper/config/rollup.js';
import getPreprocessor from 'svelte-preprocess'
import path from 'path'
import pkg from './package.json';
import postcss from 'rollup-plugin-postcss'
import replace from 'rollup-plugin-replace';
@one-aalam
one-aalam / config.js
Created July 20, 2019 17:54 — forked from codediodeio/config.js
Snippets from the Firestore Data Modeling Course
import * as firebase from 'firebase/app';
import 'firebase/firestore';
var firebaseConfig = {
// your firebase credentials
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);