Skip to content

Instantly share code, notes, and snippets.

View CekanLucas's full-sized avatar
🎯
Focusing

Lucas Cekan CekanLucas

🎯
Focusing
View GitHub Profile
@CekanLucas
CekanLucas / change_github_master_branch_name.sh
Created June 28, 2022 20:38 — forked from DevoKun/change_github_master_branch_name.sh
Change GitHub Master branch name to Main
git pull # Pull first or lose ANY commits upstream
git branch -m master main # Rename branch locally
echo
echo "Change GitHub default branch to 'main'."
echo
echo "Is GitHub Default Branch 'main'?"
echo
read -p "Press ENTER to continue"
echo
@CekanLucas
CekanLucas / transpose.js
Created April 28, 2020 03:56
Transpose a matrix (each element row index and column index is switched so matrix is 'flipped')
const transpose = function (matrix) {
// in Matrix math size is defined as m X n
// m and n are for transposed matrix
const m = matrix[0].length;
const n = matrix.length;
return [...Array(m)].map((el, i) =>
[...Array(n)].map((el, j) => matrix[j][i])
);
};
@CekanLucas
CekanLucas / math_game.rb
Created April 1, 2020 01:57
Two players play math game with three lives, if they answer incorrectly lose a life, when someone has zero lives game ends with winner and score
require 'pry'
class Player
attr_accessor :lives, :player, :guesses, :correct
def initialize(player)
@player = player
@lives = 3
@guesses = 0
@correct = 0
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>