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 / 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]);
}
}
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);
@one-aalam
one-aalam / .babelrc
Created August 23, 2017 08:35 — forked from c9s/.babelrc
webpack + babel + typescript + es6 - total solutions!
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
@one-aalam
one-aalam / _baseline.scss
Created June 17, 2016 17:45 — forked from razwan/_baseline.scss
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
@one-aalam
one-aalam / 0_reuse_code.js
Created April 1, 2016 13:46
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
@one-aalam
one-aalam / nginx-osx-install.sh
Created December 8, 2015 12:44
Mac OS X nginx installation from source
# download PCRE and nginx source
sudo mkdir -p /usr/local/src
cd /usr/local/src
# copy PCRE to directory
# eg. cp /tmp/pcre-8.20.tar.gz /usr/local/src/
tar xzvf pcre-8.20.tar.gz
cd pcre-8.20
./configure --prefix=/usr/local
make && sudo make install && make clean