Skip to content

Instantly share code, notes, and snippets.

.ripple, .ripple-mousemove {
position: relative;
overflow: hidden;
cursor: pointer;
}
.mask {
position:absolute;
width: 10px;
height: 10px;
@hunghg255
hunghg255 / reactjs-interview-tips.md
Created July 6, 2020 05:59 — forked from paulnguyen-mn/reactjs-interview-tips.md
Bí kíp cho buổi phỏng vấn ReactJS thành công 🎉

Bí kíp cho buổi phỏng vấn ReactJS thành công 🎉

From unplash.com

AGENGA:

  1. Một vài lưu ý chung
  2. Ôn tập kiến thức JS/ReactJS
  3. Cày thuật toán, giải thuật
  4. Tìm hiểu về công ty mà mình xin ứng tuyển
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
/**
* ℹ️ Topic: Use Proxy() to Set validation to javascript Object
* 📨 Contact for personalized training: sifathaque6@gmail.com 👈
*/
const userValidator = {
set(object, prop, value) {
const validProps = ['name', 'email'];
if (!validProps.includes(prop)) {
@hunghg255
hunghg255 / fast_css_reset.css
Created April 30, 2023 11:13 — forked from fabiospampinato/fast_css_reset.css
The fastest CSS reset possible
: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
@hunghg255
hunghg255 / xor.js
Created April 30, 2023 11:14 — forked from fabiospampinato/xor.js
A 99% precise neural network that learned the XOR function. There's about a 1kb fixed overhead, the model is ~just those two hex strings.
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
@hunghg255
hunghg255 / xor.js
Created April 30, 2023 11:17 — forked from fabiospampinato/xor.js
A little NN trained to learn XOR
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 ]) );
@hunghg255
hunghg255 / cursed_base64.ts
Created April 30, 2023 11:18 — forked from fabiospampinato/cursed_base64.ts
Cursed base64 encoder.
// 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;
@hunghg255
hunghg255 / fastest_escape_html.js
Created April 30, 2023 11:19 — forked from fabiospampinato/fastest_escape_html.js
The fastest way to escape HTML strings known to me~~n~~, if you need to do so with JS and you are inside a browser.
// 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 );
@hunghg255
hunghg255 / build.js
Created April 30, 2023 11:21 — forked from fabiospampinato/build.js
Fast building + watching + starting + restarting. AKA how to throw TypeScript in the garbage bin for anything other than type-checking.
/* 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' );