Skip to content

Instantly share code, notes, and snippets.

View tahashieenavaz's full-sized avatar
🍊
Still Confused

Taha Shieenavaz tahashieenavaz

🍊
Still Confused
View GitHub Profile
@tahashieenavaz
tahashieenavaz / push.cmd
Created May 22, 2022 12:08
For a more productive environment in Windows you can save this file somewhere in the PATH and use one command to add, commit and push with an specific message!
set message=%1
git add .
git commit -m %message%
git push
<?php
function insertGetIds(string $table, array $rowsToInsert) {
$ids = [];
foreach($rowsToInsert as $row) {
array_push($ids, \Illuminate\Support\Facades\DB::table($table)->insertGetId($row));
}
return $ids;
}
const random = (low, high) => low + ~~((high - low) * Math.random())
@tahashieenavaz
tahashieenavaz / consoleShortcut.js
Last active March 27, 2022 10:48
I often find myself thinking about using table or log method from console class. So to be more productive and consistent I created a little helper function for myself.
function l() {
const argumentsArray = Array.from(arguments);
const strings = argumentsArray.filter(
($arg) => $arg instanceof String || typeof $arg == "string"
);
const objects = argumentsArray.filter(
($arg) => !($arg instanceof String || typeof $arg == "string")
);
if (strings.length) {
console.log("[STRINGS]");
@tahashieenavaz
tahashieenavaz / longestCommonPrefix.js
Last active March 27, 2022 10:37
Write a function to find the longest common prefix string amongst an array of strings!
/**
* @param {string[]} strs
* @return {string}
* https://underdash.web.app
* https://leetcode.com/problems/longest-common-prefix/
* https://underdash.medium.com/spiral-matrix-javascript-c8aa2bd957e
*
* Copyright reserved by Taha Shieenavaz (Underdash)
*/
@tahashieenavaz
tahashieenavaz / spiralMatrix.js
Last active January 31, 2024 00:37
Given an m x n matrix, return all elements of the matrix in spiral order.
/**
* @param {number[][]} matrix
* @return {number[]}
* https://underdash.web.app
* https://leetcode.com/problems/spiral-matrix/
* https://underdash.tech/spiral-matrix/
* Copyright reserved by Taha Shieenavaz (Underdash)
*/