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
--max-columns: 3; | |
--min-column-width: 12rem; | |
--gap: 1rem; | |
/* Source: https://www.neatcss.dev/fluid-columns-max/ */ | |
.container { | |
display: grid; | |
grid-template-columns: | |
repeat( | |
auto-fit, |
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
// Author: ChatGPT | |
function generateCombinations(set, r) { | |
const combinations = []; | |
function generate(currentCombination, remainingSet, r) { | |
if (currentCombination.length === r) { | |
combinations.push(currentCombination); | |
return; | |
} |
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 replacer(key, value) { | |
if (value instanceof Map) { | |
return { __type: 'Map', value: Object.fromEntries(value) } | |
} | |
if (value instanceof Set) { | |
return { __type: 'Set', value: Array.from(value) } | |
} | |
return value | |
} |
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
/* | |
https://developer.android.com/guide/playcore/in-app-review | |
In app reviews implementation for NativeScript Apps | |
Pre-requisites: | |
Add Google Play Core lib to your app.gradle's dependency list | |
app/App_Resources/Android/app.gradle -> |
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
# Launch website as Chrome PWA on MacOS | |
function chromeapp { | |
url=$1; | |
{ nohup /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app=$url & } &; | |
} |
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
// An alternate solution for this challenge | |
// https://www.adimation.info/2019/12/01/decompress-a-given-string | |
function decodeString(str) { | |
let res = ''; | |
const letters = str.split(/[0-9]+/).join('').split(''); | |
letters.forEach(v => { | |
if (str.match(new RegExp(`${v}[0-9]+`))) { | |
res += v.repeat(str.match(new RegExp(`${v}[0-9]+`))[0].split(v)[1]); | |
} else { |
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 { Frame } from '@nativescript/core/ui/frame'; | |
import { Color } from '@nativescript/core/color'; | |
import { isIOS } from '@nativescript/core/platform'; | |
/* | |
// Legacy require statements if using Vanilla {N} | |
const Frame = require('@nativescript/core/ui/frame').Frame; | |
const Color = require('@nativescript/core/color').Color; | |
const isIOS = require('@nativescript/core/platform').isIOS; | |
*/ |
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
/** | |
* Tells you what's different in the incoming array when compared to exisiting array | |
* Either pass in array of objects or pass in array of strings. Don't pass mixed array. | |
* | |
* @param incomingArray | |
* @param existingArray | |
* @param {'object'|'string'} compareType | |
*/ | |
function difference(incomingArray, existingArray, compareType = 'object') { | |
const convertToStringIfNecessary = v => compareType === 'object' ? JSON.stringify(v) : v; |
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
// in app.ts before application.start | |
import * as trace from "tns-core-modules/trace"; | |
trace.setCategories(trace.categories.concat( | |
// trace.categories.Layout, // add these two for detailed | |
// trace.categories.ViewHierarchy, // add these two for detailed | |
trace.categories.NativeLifecycle, // these two are for brief | |
trace.categories.Navigation // these two are for brief | |
)); | |
// trace.setCategories(trace.categories.All); // this option is extremely detailed | |
import { setupTimestampConsoleWriter } from "./shared/traceWriter"; |
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 randColor = () => '#' + ('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6); |
NewerOlder