Skip to content

Instantly share code, notes, and snippets.

View aamirsahmad's full-sized avatar
🎯
Focusing

Aamir Ahmad aamirsahmad

🎯
Focusing
View GitHub Profile
@aamirsahmad
aamirsahmad / init.lua
Created October 17, 2023 19:20
Aamir's NVIM
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
Kickstart.nvim is *not* a distribution.
Kickstart.nvim is a template for your own configuration.
The goal is that you can read every line of code, top-to-bottom, and understand
<!DOCTYPE html>
<html>
<head>
<title>Resume - Haris Javed</title>
<style>
h2 {
color: rgb(6, 23, 123);
text-decoration: underline;
}
@aamirsahmad
aamirsahmad / find_missing_positive.py
Created November 1, 2020 15:53
41. First Missing Positive
class Solution:
def firstMissingPositive(self, nums: List[int]) -> int:
def hashset(numbers):
set_nums = set(numbers)
n = len(numbers)
for i in range(1, n + 2): # case A: [1,n] case B: n+1 if A is full i.e. 1 to n
if i not in set_nums:
return i
class Solution:
def firstMissingPositive(self, nums: List[int]) -> int:
def hashset(numbers):
set_nums = set(numbers)
n = len(numbers)
for i in range(1, n + 2): # case A: [1,n] case B: n+1 if A is full i.e. 1 to n
if i not in set_nums:
return i
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
package com.aamirahmad.intellij.stackoverflowplugin;
import com.intellij.ide.BrowserUtil;
import com.intellij.lang.Language;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.CaretModel;
import com.intellij.openapi.editor.Editor;
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
import java.math.BigInteger;
public class Solution {
public static BigInteger factorial(int n) {
BigInteger result = BigInteger.ONE;
for (; n > 1; n--) {
result = result.multiply(BigInteger.valueOf(n));
}
return result;
}
@aamirsahmad
aamirsahmad / BankAccount.js
Created August 10, 2018 19:34
A simple BankAccount implementation that uses composability and FP concepts in ES2017
// Factory function
const createBankAccount = (balance = 0, type = 'CHECKING') => ({balance, type})
// Helper
const checkIfNegative = x => {
if (x < 0)
throw Error('Value can not be negative')
return x
}
function pollution () {
if(process.env.TESTING_ENGINE === 'jasmine')
return Math.floor(Math.random() * 120);
else
return Math.floor(Math.random() * 100);
}
console.log(pollution());