Skip to content

Instantly share code, notes, and snippets.

View prio101's full-sized avatar
:shipit:
Making Stuff

Mahabub Islam Prio prio101

:shipit:
Making Stuff
View GitHub Profile
@prio101
prio101 / reverse_string.rb
Created May 1, 2025 07:52
Reverse String
require 'minitest/autorun'
# Implementation of my_reverse method
# This method takes a string as input and returns the string in reverse order.
# The method also handles edge cases such as empty strings and single-character strings.
# The method uses a loop to iterate through the string in reverse order and constructs the reversed string.
# Custom error class for handling invalid input types
# This class inherits from StandardError and provides a custom error message.
const select = document.getElementById("current_currency");
const options = Array.from(select.options);
// Remove and sort options
const sortedOptions = options.sort((a, b) => {
return a.text.localeCompare(b.text);
});
// Clear existing options and re-add sorted ones
select.innerHTML = "";
@prio101
prio101 / gist:456878dd61c506ac58d10c595de6d926
Created November 21, 2024 16:19
test_for_airwork.ai.rb
# Anagram Problem
def is_anagram(string_one, string_two)
return false if string_one.length != string_two
return true if string_one.sort == string_two
false
end
is_anagram("car", "rat") # should return false
is_anagram("anagram", "naagram") # should return true
@prio101
prio101 / python
Last active September 14, 2024 13:54
only between bn and en.
from langdetect import detect_langs
from collections import defaultdict
def split_english_bangla(mixed_string):
# To hold the detected languages and their corresponding text parts
language_dict = defaultdict(str)
# Split the string into words (or tokens)
words = mixed_string.split()
@prio101
prio101 / group_by_n.js
Last active November 25, 2021 05:00
Group by the n spice
// Idea:
// get the main result set into:
// three seperate list in a main list: [[1,2,3], [1,2], [1,2....,n]]
// Maybe here in this case js will not clone the main list .
// it will manipulate the main list. Attention to it.
list = [1,2,3,4,5,6,7,8,9]
const group_by_n = (list) => {
// same as before:
@prio101
prio101 / group-for-rows.py
Last active November 24, 2021 06:11
Grouping for the Rows
def group(arr):
print("given set of the array: ", arr)
temp_list = []
group_maker_spice = 3 # base jumper
group_maker_spice_special_case_second_row = 2
result_list = []
for item in arr:
if item == 0 and len(arr) > group_maker_spice:
# insert the first 3 in a group
@prio101
prio101 / the_builder_of_things.rb
Created April 2, 2021 01:09 — forked from Insti/the_builder_of_things.rb
A Ruby solution to "The builder of things" codewars kata
# https://www.codewars.com/kata/the-builder-of-things/ruby
# https://www.codewars.com/kata/reviews/5571e09a385f59d95f000063/groups/59426d64e6049310a70006ce
# imported to handle any plural/singular conversions
require 'active_support/core_ext/string'
class Thing
def initialize(name)
@properties = {}
is_the.name.send(name)
@prio101
prio101 / init.vim
Created October 30, 2019 08:26
init file for the NEOVIM
let os = substitute(system('uname'), "\n", "", "")
call plug#begin('~/.config/nvim/autoload/')
Plug 'morhetz/gruvbox'
Plug 'chusiang/vim-sdcv' " How to install dict see https://askubuntu.com/questions/191125/is-there-an-offline-command-line-dictionary
Plug 'scrooloose/nerdtree'
Plug 'kassio/neoterm'
Plug 'janko-m/vim-test'
Plug 'benekastah/neomake'
defmodule Router.SitesRouter do
import Plug.Conn
use Plug.Router
plug :match
plug :dispatch
get "/" do
page = EEx.eval_file("views/sites/index.html.eex")
conn
defmodule Router.MainRouter do
use Plug.Router
plug :match
plug :dispatch
get "/" do
page = EEx.eval_file("views/index.html.eex")
conn
|> put_resp_content_type("text/html")