Skip to content

Instantly share code, notes, and snippets.

View nafeu's full-sized avatar
🕶️
In Virtual Reality

Nafeu Nasir nafeu

🕶️
In Virtual Reality
View GitHub Profile
@nafeu
nafeu / server.js
Last active October 9, 2018 21:02
Simple Express.js static file/folder configuration with Express API
var express = require('express')
, app = express()
, http = require('http')
, server = require('http').Server(app)
, bodyParser = require('body-parser')
, io = require('socket.io')(server);
// ---------------------------------------------------------------------------
// Configuration
// ---------------------------------------------------------------------------
@nafeu
nafeu / .zshrc-powerlevel9k-theme
Created July 2, 2017 20:42
Nafeu's iTerm-Zsh Theme Config
# Insert into your .zshrc file
# ...
POWERLEVEL9K_MODE='awesome-patched'
ZSH_THEME="powerlevel9k/powerlevel9k"
# ...
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=""
POWERLEVEL9K_SHORTEN_DIR_LENGTH=0
@nafeu
nafeu / example.memd
Last active June 15, 2018 02:38
Example minimal-elearning presentation
---
title: "Using Minimal eLearning with Github Gists"
author: "Nafeu Nasir"
description: "A tutorial on how to create minimal-elearning presentations with Github Gists"
date: 2018-6-10
---
# Getting Started
First create a brand [new Github Gist](https://gist.github.com/), fill in the description however you'd like, and for the filename, make sure you end with the extension `.memd`. For the document itself, start off by filling it with front-matter like so:
@nafeu
nafeu / python3-script-template.py
Created January 29, 2019 12:34
Python3 Terminal Script Template
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Template for python3 terminal scripts.
This gist allows you to quickly create a functioning
python3 terminal script using argparse and subprocess.
"""
import argparse
@nafeu
nafeu / open-changed-modified-git.sh
Last active September 18, 2020 15:10
Open Changed Or Modified Files With Git
$EDITOR `echo $(git diff --name-only HEAD~ HEAD) $(git status --porcelain | awk '{print $2}')`
// promisified 'setTimeout' function
function delay(delayedFunction, time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
try {
resolve(delayedFunction());
} catch (error) {
reject(error.message);
}
}, time);
console.log('1 | print immediately');
setTimeout(() => {
console.log('2 | print after one second');
}, 1000);
console.log('1 | print immediately');
setTimeout(() => {
console.log('2 | print after one second');
}, 1000);
setTimeout(() => {
console.log('3 | print one second after line 2');
}, 2000);
console.log('1 | print immediately');
setTimeout(() => {
console.log('2 | print after one second');
setTimeout(() => {
console.log('3 | print one second after line 2');
}, 1000);
}, 1000);
function delay(delayedFunction, time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(delayedFunction());
}, time);
});
}