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 nums = [17, 1, 2, 3, -1] | |
const obj = (x) => { | |
return {initial: x, square: x*x, positive: Math.sign(x) > 0 ? true : false} | |
} | |
Array.prototype.myMap = function(cb){ | |
const output = [] | |
for(let i = 0; i<this.length; i++){ | |
output.push(cb(this[i])) |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>UFA Interactive SVG</title> | |
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | |
<link rel="apple-touch-icon" href="/apple-touch-icon.png" /> | |
<style> |
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
let imagePath: string = '' | |
const resp = await RNFetchBlob.config({ | |
fileCache: true, | |
}).fetch('GET', url) | |
imagePath = resp.path() | |
const base64 = await resp.readFile('base64') | |
fs.unlink(imagePath) |
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
<WebView | |
originWhitelist={['*']} | |
source={{ html: script }} | |
javaScriptEnabled={true} | |
onMessage={(event) => { | |
if (!event.nativeEvent?.data) { | |
return; | |
} | |
console.log(event.nativeEvent.data); | |
}} |
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 script = ` | |
<script> | |
function get_average_rgb(img) { | |
var context = document.createElement('canvas').getContext('2d'); | |
var src = img; | |
img = new Image; | |
img.setAttribute('crossOrigin', ''); | |
img.src = "data:image/png;base64," + src; | |
img.onload = function () { | |
context.imageSmoothingEnabled = true; |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<style> | |
.slider { |
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 {Injectable, NestInterceptor, ExecutionContext, CallHandler, Inject, Logger} from '@nestjs/common' | |
import {map, Observable, tap} from 'rxjs' | |
import {RedisService} from './redis.service' | |
@Injectable() | |
export class CacheInterceptor implements NestInterceptor { | |
@Inject() redisService: RedisService | |
async intercept(context: ExecutionContext, next: CallHandler): Promise<Observable<any>> { | |
if (process.env.NODE_ENV.includes('development')) { |
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 data = [ | |
'the bright blue butterfly hangs on the breeze', | |
'its best to forget the great sky and to retire from every wind', | |
'under blue sky in bright sunlight, one not need search around', | |
'Love is blind. ', | |
`I don't want to go to school.`, | |
`Let's get it over with.`, | |
`The red one. `, | |
`I have a big dog. `, | |
`Where's the nearest bus stop? `, |
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 React, { ReactNode, useState, useEffect } from "react" | |
import { useRouter } from "next/router" | |
import Script from "next/script" | |
const useScript = (paths: string[]) => { | |
const [scriptTag, setScriptTag] = useState<ReactNode>(<></>) | |
const router = useRouter() | |
useEffect(() => { |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> |
NewerOlder