This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertPlainObject (nestedObj, baseKey = '', result = {}) { | |
Object.entries(nestedObj).forEach(([key, value]) => { | |
if (typeof value === 'object') { | |
return convertPlainObject(value, baseKey === '' ? key : `${baseKey}.${key}`, result); | |
} | |
result[`${baseKey}.${key}`] = value; | |
}); | |
return result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... others | |
include: | |
- project: "script-keeper/base/pipeline" | |
file: "/script-keeper.yml" | |
# ... others |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ScriptKeeperClient } from '@/apis'; | |
class ScriptKeeperService { | |
async getAppScript(appName) { | |
const { data } = await ScriptKeeperClient.get(`scripts/${appName}`); | |
return { | |
appSrc: data.src, | |
chunkSrc: data.chunk, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variables: | |
SCRIPT_KEEPER_API_URL: https://stage-script-keeper.your-domain.com | |
Script Keeper: | |
stage: Deploy STAGE | |
extends: .register_script_keeper_stage | |
variables: | |
APP_NAME: $CI_PROJECT_NAME # gitlab predefined variable | |
MANIFEST_PATH: dist/manifest.json # manifest.json path | |
image: docker:19.03.5 | |
services: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MANIFEST_PATH="$3" | |
SRC=$(jq '."app.js"' $MANIFEST_PATH) | |
CHUNK=$(jq '."chunk-vendors.js"' $MANIFEST_PATH) | |
APP_NAME="$1" | |
SCRIPT_KEEPER_API_URL="$2" | |
if [ "$SRC" = null ] || [ ! "$SRC" ] | |
then | |
echo 'Could not find app.js in manifest.json'; | |
exit 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scorePrinter = function() { | |
const SCORES = [ | |
{score: 90, text: 'AA ile dersi gectiniz'}, | |
{score: 85, text: 'BA ile dersi gectiniz'}, | |
{score: 80, text: 'BB ile dersi gectiniz'}, | |
{score: 75, text: 'CB ile dersi gectiniz'}, | |
{score: 50, text: 'Kosullu gectiniz.'}, | |
]; | |
const print = (score) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.toString = function() { | |
return this(); | |
} | |
const multiplier = (...args) => { | |
if (args.length === 0) { | |
return multiplier; | |
} | |
const rest = args.splice(1); | |
if (rest.length === 0 && Array.isArray(args[0])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TrendyolPaymentCalculator = (() => { | |
const $this = {}; | |
const months = ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'] | |
$this.calculate = async () => { | |
const calculatableResult = checkForCalculatable(); | |
if (!calculatableResult.isValid) { | |
console.error(calculatableResult.message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const memo = () => { | |
const cache = {}; | |
return function() { | |
const key = Object.values(arguments).join('_'); | |
if (key in cache) { | |
return cache[key]; | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(event, func) { | |
const target = event.target; | |
clearTimeout(target.setTimeoutId); | |
target.setTimeoutId = setTimeout(() => func(target.value), 500); | |
} | |
document.getElementById("name") | |
.addEventListener("keyup", (event) => { | |
debounce(event, (value) => { |
NewerOlder