Skip to content

Instantly share code, notes, and snippets.

View anonymoustafa's full-sized avatar

Mostafa Ramezani anonymoustafa

View GitHub Profile
@anonymoustafa
anonymoustafa / git_create_orphan.sh
Created September 4, 2020 16:33 — forked from seanbuscay/git_create_orphan.sh
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@anonymoustafa
anonymoustafa / fibbo-series.0.01.js
Created December 17, 2021 10:50
This gist is a nodeJS file that simply prints Fibonacci series to the 300th sentence. The point is, the whole job is organized within a FOR loop.
for (let i = 0, j = 1, temp;
j<300;
temp = i, i = j, j = i + temp)
{console.log(j);};
@anonymoustafa
anonymoustafa / fibbo-series.0.0.2.js
Created December 17, 2021 10:52
A more complete Fibonacci series calculator. Written in NodeJS
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
// ask user for the name input
rl.question(`What Fibbonacci sentence do you want to calculate? `, (last_fibbo_sentence) => {
@anonymoustafa
anonymoustafa / triangle.0.0.1.js
Created December 17, 2021 11:04
Drawing triangles in terminal using nodejs.
let s = "*";
for (; s.length < 99; s = "*" + s)
console.log(s);
@anonymoustafa
anonymoustafa / .vimrc
Last active July 5, 2022 07:11
my .vimrc configuartions
set nocompatible " be iMproved, required
set autochdir " when making new file, the pwd is the path. not the root.
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@anonymoustafa
anonymoustafa / v-lang
Last active January 19, 2022 07:42
When installing vlang on fedora, do these steps or it won't work.
$ sudo dnf install libatomic
$ sudo ./v symlink
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
// Link to main question ==> https://twitter.com/Loc0m0/status/1508697606716764162?s=20&t=Ziozpzj6KIznNArdT9n3xQ
const splicer = function () {
let accumulator = "";
for (let i = 1; i <= 100_000; i++) {
accumulator = accumulator + "0" + i.toString();
}
let arrayOfStrings = accumulator.split("0");
let arrayOfNumbers = arrayOfStrings.map(Number);
let result = arrayOfNumbers.reduce((sum, current) => sum + current, 0);
console.log(result);
// link to the main tweet: https://twitter.com/iam_vee/status/1517357609170386944?s=20&t=MN3UgYbDae5NCTSoeh5mzg
var sum = 0, counter = 0,
maxTries = 1000_000;
for (let i = 1; i <= maxTries; i++) {
counter++;
while (1) {
sum++;
if (gimmeRand1to6() == 6) break;
}
}
@anonymoustafa
anonymoustafa / index.js
Created May 6, 2022 17:44
simplest-react-index.js files ever
import React from 'react';
import ReactDOM from 'react-dom/client';
const root = ReactDOM.createRoot(document.getElementById("root"));
const element = <h1> Hello, world </h1>;
root.render(element);