This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
NewerOlder