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
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { |
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
button = document.getElementById('start'); | |
button.onclick = show; | |
function show(){ | |
document.body.innerHTML = Date(); | |
setInterval(show, 1000); | |
} |
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
function change(){ | |
var show_div = document.getElementById("show_div"); | |
var i = document.getElementById("i"); | |
show_div.innerHTML = i.value.toUpperCase(); | |
} |
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
var dynamic = document.getElementById('dynamic'); | |
dynamic.addEventListener('click', dynamic_click); | |
function dynamic_click() { | |
alert(Math.random()); | |
dynamic.removeEventListener('click', dynamic_click); | |
} |
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
class Quran | |
def initialize | |
# could be ARGV OR Any other path you prefer | |
@path = '/Users/a7madx7/Downloads/المصحف\ الجوامعي' | |
end | |
private | |
def suggest | |
# related to the quran could be changed |
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
# ☺ | |
puts "" | |
name = gets.chomp | |
puts "Welcome, #{name}" | |
class Player | |
attr_accessor :name, :health, :power | |
def initialize(n, h, pow) | |
@name = n | |
@health = h | |
@power = pow |
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
# Parts of Patterns | |
s0, s1, s2, s3, s4, s5 = " o ", " ", " - ", "| ", " |", "| |" | |
# Patterns of Numbers | |
n = { | |
":" => [s1, s0, s1, s0, s1], | |
"0" => [s2, s5, s1, s5, s2], | |
"1" => [s1, s4, s1, s4, s1], | |
"2" => [s2, s4, s2, s3, s2], | |
"3" => [s2, s4, s2, s4, s2], |
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
puts 'Provide the sentence you want to perform letter frequency on' | |
text = gets.chomp # gets the sentence to iterate | |
puts "Performing on: #{text[0..6]}..." | |
text.downcase! | |
freqs = {} # creating a hash to iterate 'text' | |
freqs.default = 0 | |
count = 0 # number of charachters in 'text' | |
# iterating through text | |
text.each_char do |char| |
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 'date' | |
def my_next_n_birthdays(number_of_years = 60, birthday = 24, birth_month = 8) | |
lazy_dates = (Date.today..Date.new(9999)).lazy | |
my_next_birthdays = lazy_dates.select { |d| d.day == birthday and d.month == birth_month }.first(number_of_years).map { |date| "#{date.strftime('%A')} - #{date}"} | |
end | |
puts my_next_n_birthdays |
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_relative 'random_password' | |
include RandomPassword | |
class Array | |
def selection_sort | |
start_time = Time.now | |
# Selection sort (very slow on large lists) | |
a = self | |
# get the number of indices in the array | |
n = a.size - 1 |
NewerOlder