Skip to content

Instantly share code, notes, and snippets.

View ZenulAbidin's full-sized avatar
🎯
Focusing...

Ali Sherief ZenulAbidin

🎯
Focusing...
View GitHub Profile
@ZenulAbidin
ZenulAbidin / WideNumberInput.js
Last active April 27, 2023 11:08
Number Input for Material UI v5, suitable for mobile devices
// Copyright 2022 Ali Sherief
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@ZenulAbidin
ZenulAbidin / NumberInputv2.js
Last active April 27, 2023 11:08
Number Input for Material UI v5 (mark 2)
// Copyright 2022 Ali Sherief
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@ZenulAbidin
ZenulAbidin / NumberInputv1.js
Last active April 27, 2023 11:09
Number Input for Material UI v5 (mark 1)
// Copyright 2022 Ali Sherief
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@ZenulAbidin
ZenulAbidin / non-recursive.py
Created September 5, 2022 22:04
non-recursive functions in Python
# Credits: https://medium.com/@ujjawalsinhacool16021998/easily-convert-recursive-solutions-to-non-recursive-alternatives-4fa6e1acf702
# Simple function, two branches which does not return a value
def simple2_noreturn(inputs):
CALL, HANDLE = 0, 1
call_stack = [(CALL, inputs)]
while call_stack:
action, data = call_stack.pop()
if action == CALL:
call_stack.append((HANDLE, some_data))
@ZenulAbidin
ZenulAbidin / button-render.py
Last active April 27, 2023 11:11
Render duotone button plugin in GIMP
# Copyright 2021 Ali Sherief
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
const path = require('path');
module.exports = {
mode: 'development',
entry: {
index: './src/index.js',
another: './src/another-module.js',
index: {
import: './src/index.js',
dependOn: 'shared',
const Person = props => {
const { person } = props;
// You can validate `person` object here, for example
const { name, age, skill } = person;
return (
<div>
<h2>
I am {name},My age is {age},I know {skill}
</h2>
</div>
@ZenulAbidin
ZenulAbidin / cloud9-lambda.sh
Last active July 4, 2021 18:36
Script to upload the generated ZIP files to the respective AWS Lambda function beginning with "-tools".
for i in $(ls ~/environment/tools)
do
# Assume Lambda function is named like this: "tools-<foldername>"
AWS_PAGER="" aws lambda update-function-code --function-name "tools-${i}" --zip-file "fileb://~/environment/tools/${i}/lambda-func.zip"
done
@ZenulAbidin
ZenulAbidin / cloud9-zip.sh
Created July 4, 2021 18:33
Simple script to zip each subfolder representing lambda function code.
#!/bin/bash
cd tools
# Assume that all lambda functions are located in tools/ subfolder
for i in $(ls ~/environment/tools); do cd $i; lzip-python; cd ..; done
cd ..
# lzip-python is an alias for this command:
alias lzip-python="~/environment/lzip-python.sh"
# This should be placed at the end of your .bashrc.
# It itself is another script, to be named lzip-python.sh, that contains the following:
@ZenulAbidin
ZenulAbidin / state-pattern.cpp
Last active June 26, 2021 21:16
Implementation of the State pattern in C++
/*
* In this function, replace *Context* with the class you want to add state for.
* Of course, there will be only one State abstract class per Context class,
* but a variable number of conrete State classes.
*/
class State {
public:
State() {}