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
| var mediaJSON = { "categories" : [ { "name" : "Movies", | |
| "videos" : [ | |
| { "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
| "subtitle" : "By Blender Foundation", | |
| "thumb" : "images/BigBuckBunny.jpg", | |
| "title" : "Big Buck Bunny" | |
| }, | |
| { "description" : "The first Blender Open Movie from 2006", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
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
| // only works on react 18 | |
| import { useSyncExternalStore } from "react"; | |
| export const useColorScheme = () => { | |
| const scheme = useSyncExternalStore( | |
| subscribe, | |
| getSnapshot, | |
| getServerSnapshot | |
| ); |
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
| [ | |
| { "text": "0οΈβ£", "name": "0", "keyword": ":0:" }, | |
| { "text": "1οΈβ£", "name": "1", "keyword": ":1:" }, | |
| { "text": "π", "name": "10", "keyword": ":10:" }, | |
| { "text": "π―", "name": "100", "keyword": ":100:" }, | |
| { "text": "π₯", "name": "1st Place Medal", "keyword": ":1st-place-medal:" }, | |
| { "text": "2οΈβ£", "name": "2", "keyword": ":2:" }, | |
| { "text": "π₯", "name": "2nd Place Medal", "keyword": "2nd-place-medal:" }, | |
| { "text": "3οΈβ£", "name": "3", "keyword": ":3:" }, | |
| { "text": "π₯", "name": "3rd Place Medal", "keyword": ":3rd-place-medal:" }, |
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 */ | |
| const esbuild = require ( 'esbuild' ); | |
| const {nodeExternalsPlugin} = require ( 'esbuild-node-externals' ); | |
| const monex = require ( 'monex' ); | |
| const path = require ( 'path' ); | |
| const {color, parseArgv} = require ( 'specialist' ); | |
| const Watcher = require ( 'watcher' ); |
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
| // Can you make this faster? Ping me. | |
| const escapeHtml = (function () { | |
| const serializer = new XMLSerializer (); | |
| const attr = document.createAttribute ( 'attr' ); | |
| const re = /[&<>"]/; | |
| return function escapeHtml ( str ) { | |
| if ( !re.test ( str ) ) return str; | |
| attr.value = str; | |
| return serializer.serializeToString ( attr ); |
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
| // It's the fastest pure-JS base64 encoder (that doesn't account for padding though) that I've found. | |
| // It's cursed because it takes ~2s to startup and 16MB of memory π | |
| const encoder = new TextEncoder (); | |
| const lookup = (() => { | |
| const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split ( '' ); | |
| const lookup = new Array ( 2 ** 24 ); | |
| const mask1 = 0b11111100_00000000_00000000; | |
| const mask2 = 0b00000011_11110000_00000000; |
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 XOR(d){const a={0:1,1:1,7:.05,2:2,3:-2.8,4:-.09,5:2,6:-4.8,8:.04,26:5.7,14:.9,9:10,10:4.5,11:3.3,12:6.8,13:-5.6,15:.01,27:-7.9,21:.9,16:3.8,17:6.4,18:-1.1,19:5,20:2.5,22:0,28:4.7,29:.08,23:2.2,24:-2.3,25:.5,30:.08};a[0]=d[0],a[1]=d[1],a[2]=a[3],a[3]=a[4],a[3]+=a[0]*a[5],a[3]+=a[1]*a[6],a[7]=1/(1+Math.exp(-a[3])),a[8]=a[7]*(1-a[7]),a[9]=a[10],a[10]=a[11],a[10]+=a[0]*a[12],a[10]+=a[1]*a[13],a[14]=1/(1+Math.exp(-a[10])),a[15]=a[14]*(1-a[14]),a[16]=a[17],a[17]=a[18],a[17]+=a[0]*a[19],a[17]+=a[1]*a[20],a[21]=1/(1+Math.exp(-a[17])),a[22]=a[21]*(1-a[21]),a[23]=a[24],a[24]=a[25],a[24]+=a[7]*a[26],a[24]+=a[14]*a[27],a[24]+=a[21]*a[28],a[29]=1/(1+Math.exp(-a[24])),a[30]=a[29]*(1-a[29]);var b=[];return b[0]=a[29],b} | |
| console.log ( XOR ([ 0, 0 ]) ); | |
| console.log ( XOR ([ 0, 1 ]) ); | |
| console.log ( XOR ([ 1, 0 ]) ); | |
| console.log ( XOR ([ 1, 1 ]) ); |
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 xor(t){const _=xor;return _._||(_._=!0,_.p=(e,t)=>{const r=[];for(let n=0,c=e.length;n<c;n++){r[n]=[];for(let c=0,a=t[0].length;c<a;c++){let a=0;for(let r=0,l=e[0].length;r<l;r++)a+=e[n][r]*t[r][c];r[n][c]=a}}return r},_.m=(e,t)=>{const r=new Array(e.length);for(let n=0,c=e.length;n<c;n++){r[n]=new Array(e[n].length);for(let c=0,a=e[n].length;c<a;c++)r[n][c]=t(e[n][c],n,c)}return r},_.d=(e,t)=>{const r="float64"===t?Float64Array:Float32Array;return e.split("|").map((e=>{const t=e.length/2,n=r.BYTES_PER_ELEMENT,c=new ArrayBuffer(t+(t%n?n-t%n:0)),a=new Uint8Array(c),l=new r(c);for(let t=0,r=e.length;t<r;t+=2)a[t/2]=parseInt(e.slice(t,t+2),16);return Array.from(l).slice(0,t)}))},_.a0=(e,t)=>{const r=1/(1+Math.exp(-e));return t?r*(1-r):r},_.a1=(e,t)=>{const r=1/(1+Math.exp(-e));return t?r*(1-r):r},_.w0=_.d("cf70bbc08a93cfc043c6bb40c6ee8240|de3eb8c06b4a4e4080843bc0480001c1"),_.w1=_.d("c98b9fc1|eb82af40|dd0cbac0|e8d02d41")),_.m(_.p(_.m(_.p([t],_.w0),_.a0),_.w1),_.a1)[0][0]} | |
| console.log(xor([0,0])); | |
| consol |
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
| :where(abbr), :where(address), :where(area), :where(article), :where(aside), :where(audio), :where(b), :where(base), :where(bdi), :where(bdo), :where(big), :where(blockquote), :where(body), :where(br), :where(caption), :where(cite), :where(code), :where(col), :where(colgroup), :where(data), :where(datalist), :where(dd), :where(del), :where(details), :where(dfn), :where(dialog), :where(dl), :where(dt), :where(em), :where(embed), :where(fieldset), :where(figcaption), :where(figure), :where(footer), :where(form), :where(h1), :where(h2), :where(h3), :where(h4), :where(h5), :where(h6), :where(head), :where(header), :where(hgroup), :where(hr), :where(i), :where(input), :where(ins), :where(kbd), :where(keygen), :where(label), :where(legend), :where(li), :where(link), :where(main), :where(map), :where(mark), :where(menu), :where(menuitem), :where(meta), :where(meter), :where(nav), :where(object), :where(ol), :where(optgroup), :where(option), :where(output), :where(param), :where(picture), :where(pre), :where(progress |
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
| /** | |
| * βΉοΈ Topic: Use Proxy() to Set validation to javascript Object | |
| * π¨ Contact for personalized training: [email protected] π | |
| */ | |
| const userValidator = { | |
| set(object, prop, value) { | |
| const validProps = ['name', 'email']; | |
| if (!validProps.includes(prop)) { |