This file contains hidden or 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 { type } from 'ramda'; | |
| const isObject = (value: unknown) => type(value) === 'Object'; | |
| export const getPath = ( | |
| obj: Record<string, any>, | |
| key: string, | |
| path: string[] = [] | |
| ): string[] | undefined => { | |
| if (!isObject(obj)) { |
This file contains hidden or 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 { curry, type } from 'ramda'; | |
| const isObject = (obj: unknown) => type(obj) === 'Object'; | |
| const isArray = (obj: unknown) => Array.isArray(obj); | |
| // @ts-ignore-next-line | |
| const omitDeepBy = curry( | |
| (pred: (key: string, value: unknown) => boolean, obj: any) => { | |
| if (isArray(obj)) { | |
| return obj.map(omitDeepBy(pred)); |
This file contains hidden or 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 React from 'react'; | |
| import {StyleSheet} from 'react-native'; | |
| interface $ComponentName$Props {} | |
| const $ComponentName$:React.FC<$ComponentName$Props> = ({}) => { | |
| return ($END$) | |
| } | |
| export default $ComponentName$; |
This file contains hidden or 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 range(start, end) { | |
| return [...Array(end)].keys().map(el => el + start) | |
| } |
This file contains hidden or 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 (key, initialValue) => { | |
| const [value, setValue] = useState(() => { | |
| return localStorage.getItem(key) || initialValue | |
| }) | |
| useEffect(() => { | |
| localStorage.setItem(key, value) | |
| }, [value]) | |
| return [value, setValue] |
This file contains hidden or 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
| <View style={{ flexDirection: "row" }}> | |
| <Text numberOfLines={1} style={{ flex: 1, textAlign: "left" }}> | |
| {title} | |
| </Text> | |
| <Text style={{ textAlign: "right" }}>{duration}</Text> | |
| </View>; |
This file contains hidden or 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 { Platform } from 'react-native'; | |
| const isWeb = Platform.OS === 'web'; | |
| const isNative = !isWeb; | |
| const isIos = Platform.OS === 'ios'; | |
| const isAndroid = Platform.OS === 'android'; | |
| const isDesktop = isWeb && typeof matchMedia !== 'undefined' && matchMedia('(min-width: 768px)').matches; | |
| const isMobile = !isDesktop; |
This file contains hidden or 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
| <div *ngFor="let item of listObservable | async | reverse"> | |
| {{item?.whatever}} | |
| </div> | |
| import { Pipe, PipeTransform } from '@angular/core'; | |
| @Pipe({ | |
| name: 'reverse' | |
| }) | |
| export class ReversePipe implements PipeTransform { |
This file contains hidden or 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/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/ | |
| // Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch | |
| // async function | |
| async function fetchAsync () { | |
| // await response of fetch call | |
| let response = await fetch('https://api.github.com'); | |
| // only proceed once promise is resolved | |
| let data = await response.json(); | |
| // only proceed once second promise is resolved |
This file contains hidden or 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
| sudo add-apt-repository ppa:noobslab/themes | |
| sudo apt-get update | |
| sudo apt-get install royal-gtk-theme |