Skip to content

Instantly share code, notes, and snippets.

View theHamdiz's full-sized avatar
🎯
Focusing

Ahmad Hamdi theHamdiz

🎯
Focusing
View GitHub Profile
# 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],
# ☺
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
@theHamdiz
theHamdiz / quran_suggest.rb
Last active February 20, 2018 06:53
كود روبي بسيط يقوم باقتراح وفتح صفحه من القرآن عشوائيه لك لقرائتها. #Ruby script to suggest a page from the #Quran to read and open it. This base script could be further twisted to select a random #book for you to read and actually open it for you. or any other paged book that you have its pages available in your hard drive or on the internet.
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
@theHamdiz
theHamdiz / dynamic_event_listener.js
Created March 31, 2018 22:59
Add dynamic event listener and remove it on the fly in js.
var dynamic = document.getElementById('dynamic');
dynamic.addEventListener('click', dynamic_click);
function dynamic_click() {
alert(Math.random());
dynamic.removeEventListener('click', dynamic_click);
}
@theHamdiz
theHamdiz / copy_cat_input_to_div.js
Created March 31, 2018 23:00
copy the exact text of input to a div on change in js
function change(){
var show_div = document.getElementById("show_div");
var i = document.getElementById("i");
show_div.innerHTML = i.value.toUpperCase();
}
@theHamdiz
theHamdiz / simple_clock_app_in_js.js
Created March 31, 2018 23:01
a digital clock app that refreshes itself every second.
button = document.getElementById('start');
button.onclick = show;
function show(){
document.body.innerHTML = Date();
setInterval(show, 1000);
}
@theHamdiz
theHamdiz / main.dart
Created December 25, 2023 09:16
Generated code from pixels2flutter.dev
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {