Skip to content

Instantly share code, notes, and snippets.

View micedreams's full-sized avatar
💋
.

Akshatha Sathish micedreams

💋
.
View GitHub Profile
def create
@question = Question.new(question_params)
respond_to do |format|
if @question.save
format.html { redirect_to @question, notice: "Question was successfully created." }
format.json { render :show, status: :created, location: @question }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @question.errors, status: :unprocessable_entity }
void main() {
int resultFindNthSmallest;
int resultsumOf;
int resultPersistance;
resultFindNthSmallest = findNthSmallest([6, 2, 9, 1], 2);
print("findNthSmallest([6, 2, 9, 1], 2) =$resultFindNthSmallest");
resultFindNthSmallest =
findNthSmallest([57, 3, 0, -5, 2, 67, 32, 9, 1, 2], 5);
print(
@micedreams
micedreams / findNthSmallest.dart
Created February 14, 2022 15:02
fineSwap screening test example 1
void main() {
int resultFindNthSmallest;
resultFindNthSmallest = findNthSmallest([6, 2, 9, 1], 2);
print("findNthSmallest([6, 2, 9, 1], 2) =$resultFindNthSmallest");
resultFindNthSmallest =
findNthSmallest([57, 3, 0, -5, 2, 67, 32, 9, 1, 2], 5);
print(
"findNthSmallest([57, 3, 0, -5, 2, 67, 32, 9, 1, 2], 5) = $resultFindNthSmallest");
}
void main() {
int resultsumOf;
resultsumOf = sumOf([9, 34, -23, 0, 4, 8,1]);
print("sumOf([9, 34, -23, 0, 4, 8,1]) =$resultsumOf");
resultsumOf = sumOf([901, 492, -10223, 3791, 243, 2]);
print("sumOf([901, 492, -10223, 3791, 243, 2]) =$resultsumOf");
}
int sumOf(List<int> integers) {
void main() {
int resultPersistance;
resultPersistance = multiplicativePersistenceOf(489);
print("multiplicativePersistenceOf(489) =$resultPersistance");
resultPersistance = multiplicativePersistenceOf(912);
print("multiplicativePersistenceOf(912) =$resultPersistance");
}
@micedreams
micedreams / cow_n_bull.md
Last active November 12, 2023 10:38
Cow and bull
Concept:
On a sheet of paper, the players each write a 4-digit secret number. 
The digits must be all different. Then, in turn, the players try to guess their opponent's number who 
gives the number of matches. If the matching digits are in their right positions, they are "bulls",
if in different positions, they are "cows". 

Example: Secret number: 4271 Opponent's try: 1234 
Answer: 1 bull and 2 cows. (The bull is "2", the cows are "4" and "1".)
Task:
@micedreams
micedreams / drop_down_menu_demo.md
Created November 12, 2023 10:42
Drop down menu in flutter

Dropdown in flutter

224478949-d76fa2f9-7a99-4eae-b186-17895accd5cb.mov

what is a drop-down menu?

  • It is a list. A graphical control element that lets a user pick one value from a list.
  • It has two states, active and inactive.
  • When a drop-down is inactive, it displays a single value.
  • When it is activated, it displays a list of values, from which a single value can be selected.
  • They are generally used to save space.
  • Offering drop-down menus can help users avoid scrolling and can quickly get them to access the correct option.
  • Since they look very much like text fields and it is a way to make the form look more cohesive when there is a need in the form to have a question that needs specific input.
@micedreams
micedreams / fizbuz.rb
Created November 12, 2023 10:57
Ruby Fizbuz
def fizz_buzz(n)
if n % 10 == 0
"FizzBuzz"
elsif n % 5 == 0
"Buzz"
elsif n % 2 == 0
"Fizz"
else
n
end
@micedreams
micedreams / fizbuzz.py
Created November 12, 2023 10:58
python fizbuzz
def fizz_buzz(n):
if n % 10 == 0 :
return "FizzBuzz"
elif n % 5 == 0:
return "Buzz"
elif n % 2 == 0:
return "Fizz"
else:
return n
@micedreams
micedreams / fizbuz.dart
Created November 12, 2023 11:04
Dart fizbuzz
void main() {
for(i=0; i<20;i++){
print(fizz_buzz(i));
}
}
String fizzBuzz() {
if (i % 3 == 0 && i % 5 == 0) {
return "FizzBuzz";
} else if (i % 3 == 0) {