Skip to content

Instantly share code, notes, and snippets.

View Blazing-Mike's full-sized avatar
👷
Focusing

Michael Blazing-Mike

👷
Focusing
  • Earth C-137
View GitHub Profile
// This is just snippets showing how signature functions works
// Generate private key and public key
generate_keys(){
return (priv_key, pub_key);
}
// sign a message using you private key( still kept secret)
sign(message, priv_key){
return signature; // a signature is returned
fn main() {
let age = 18;
if x < 18 {
println!('you are too young');
} else if x == 18 {
println!('you are just the right age');
} else {
println!(' wow, you are old, enjoy !!! ');
}
// writing if statements as swich statements
//This IF/ELSE statement
if(x === 'value1'){
...
} else if (x = 'value2'){
...
} else{
...
// Learning ternary operators
// Traditional way
let message;
if (login == 'Employee') {
message = 'Hello';
} else if (login == 'Director') {
message = 'Greetings';
} else if (login == '') {
@Blazing-Mike
Blazing-Mike / function__if__statements.rs
Created September 24, 2021 19:24
function and if statement i wrote in my rustlings exercise
fn main() {
let answer = square(10);
println!("The answer is {}", answer);
}
fn square(num: i32) -> i32 {
num * num
}
@Blazing-Mike
Blazing-Mike / binarytodecimal.js
Created August 28, 2021 00:32
Convert Binary to decimal with javascript
// METHOD 1 (IN-BUILT FUNCTION)
function convertBaseToBinary(bin) {
return parseInt(bin, 2).toString(10); // Convert arguments from one radix/base to radix in toString()/
}
// USING FOR LOOP & parseInt FUNCTION
function bin2dec(bin) {
var decimal = 0;
for (var index = bin.length - 1; index >= 0; index--) {
@Blazing-Mike
Blazing-Mike / index.html
Created August 23, 2021 23:52
code for form validation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- displays site properly based on user's device -->
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png">
<link rel="stylesheet" href="style.css">
<title>Frontend Mentor | Intro component with sign up form</title>