Skip to content

Instantly share code, notes, and snippets.

View dxc04's full-sized avatar
🤗

Dixie Philamerah J. Atay dxc04

🤗
View GitHub Profile
@dxc04
dxc04 / stocks_array_challenge.js
Created May 29, 2020 07:56
Stocks array challenge
function stocksArrayChallenge(arr) {
const length = arr.length;
const minIndex = arr.reduce((min, cur, i, arr) => cur < arr[min] ? i : min, 0);
const maxIndex = arr.reduce((max, cur, i, arr) => cur > arr[max] ? i : max, 0);
if (length < 2 || (length == 2 && maxIndex < minIndex) ) {
return -1;
}
@dxc04
dxc04 / aheadOrBehind.txt
Last active June 3, 2020 08:17
git: checks if branch is updated or behind from a remote branch
git rev-list --left-only origin/master...feature_branch
# You can add/use flag
# --right-only is for "ahead" information
# --left-only is for "behind" information
# --count to count the number of commits behind or ahead
@dxc04
dxc04 / isBranchHasConflicts
Created June 3, 2020 08:24
checks if branch has conflicts
git ls-files -u
@dxc04
dxc04 / isBranchAlreadyMerged.sh
Created June 3, 2020 08:36
checks if the branch was already merged
wasMerged1=$(git branch -r --merged ${origin} | grep ${tomerge} | wc -l)
wasMerged2=$(git log --oneline ${origin}..${tomerge} 2> /dev/null | wc -l)
if [[ "$wasMerged1" -gt 0 && "$wasMerged2" -gt 0 ]]; then
echo "It was merged!"
fi
@dxc04
dxc04 / tsconfig.json
Created June 30, 2020 09:13
ts config on vue web/lib components
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"allowJs": true,
@dxc04
dxc04 / vue.config.js
Created June 30, 2020 09:27
Web Lib Components and typescript vue configurations
module.exports = {
configureWebpack: {
output: {
libraryExport: "default"
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
@dxc04
dxc04 / ts-loader.vue.config.js
Created July 3, 2020 10:36
Vue Cli Plugin Configuration for ts-loader
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
include: /src/,
loader: "ts-loader",
options: {