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
export function isFunction(arg) { | |
return typeof arg === 'function'; | |
} | |
const cachedKeys = new Map(); | |
/** | |
* Get data by key | |
* const data = {age: {value: 9}}; | |
* getData(data, 'age.value') => 9 | |
* getData(data, 'age.buzz') => 'age.buzz' | |
* |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>DbSchema License Key Generator</title> | |
</head> | |
<body> |
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 qs = require('querystring'); | |
const http = require('http'); | |
const https = require('https'); | |
const assert = require('assert'); | |
const config = { | |
port: 3000, | |
projectId: '', | |
pipelineTriggerToken: '', | |
secretToken: null |
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
window.addEventListener("message", function (event) { | |
console.log(event); | |
}, false); | |
console.log(123; |
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 kebabCase(str) { | |
return str.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, match => '-' + match.toLowerCase()) // lower case and add - | |
.replace(/[^\w]/g, '-') // replace non-word characters by - | |
.replace(/-+/g, '-') // remove multiple - characters | |
.replace(/^-|-$/g, ''); // trim first and last - character | |
} |
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
(async function (globalOptions) { | |
let batch = 1; | |
window['finalResult'] = { | |
user_id: '', | |
requestToken: '', | |
messages: [], | |
friend: {id: globalOptions.friend_id || 0, name: ''} | |
}; | |
if (!finalResult.friend.id) { |
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 { DateAdapter } from 'angular-calendar'; | |
import { DateTime, DateTimeOptions } from 'luxon'; | |
export function getLuxonObject(value: Date | string | number, options?: DateTimeOptions & { format?: string }): DateTime { | |
if (value instanceof DateTime) { | |
return value; | |
} | |
let dateTime: DateTime; | |
if (value instanceof Date) { | |
dateTime = DateTime.fromJSDate(value, options); |
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 { Component } from '@angular/core'; | |
import { LoaderService } from './loader.service'; | |
import { timer } from 'rxjs'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<p> | |
<button (click)="randomTimeout()">Random time out</button> | |
</p> |
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
module.exports = function (config) { | |
const buzz = `${Date.now()}.buzz`; //change the value to what do you want | |
if (config.output.filename) { | |
const splicedOut = config.output.filename.split('.'); | |
config.output.filename = `${splicedOut.slice(0, -1).join('.')}.${buzz}.${splicedOut.slice(-1).join('.')}`; | |
} | |
if (config.output.chunkFilename) { | |
const splicedOut = config.output.chunkFilename.split('.'); | |
config.output.chunkFilename = `${splicedOut.slice(0, -1).join('.')}.${buzz}.${splicedOut.slice(-1).join('.')}`; | |
} |
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
export const IMAGE_OPTIMIZER_OPTIONS = { | |
MAX_WIDTH: 1920, | |
MAX_HEIGHT: 1080, | |
MAX_QUALITY: 0.8 | |
}; | |
export function optimizeImageFile(file, {MAX_WIDTH, MAX_HEIGHT, MAX_QUALITY} = IMAGE_OPTIMIZER_OPTIONS) { | |
return new Promise(resolve => { | |
const img = document.createElement('img'); |
OlderNewer