Skip to content

Instantly share code, notes, and snippets.

View arthurfanti's full-sized avatar
🎯
Focusing

Arthur Fanti arthurfanti

🎯
Focusing
View GitHub Profile
@arthurfanti
arthurfanti / minWindowSubstring.js
Created August 11, 2023 12:33
Sliding window technique
function minWindowSubstring(s, t) {
// Initialize frequency maps for characters in strings s and t
const charFreqT = new Map();
const charFreqS = new Map();
// Fill charFreqT with characters and their frequencies from t
for (const char of t) {
charFreqT.set(char, (charFreqT.get(char) || 0) + 1);
}
@arthurfanti
arthurfanti / index.jsx
Created August 9, 2023 23:15
react tic tac toe (with finite state machine-ish)
import React, { useCallback, useState } from 'react';
import { createRoot } from 'react-dom/client';
const containerStyle = {
'display': 'flex',
'alignItems': 'center',
'flexDirection': 'column'
}
const instructionsStyle = {
@arthurfanti
arthurfanti / A-Pen-by-Arthur-Fanti.markdown
Created October 15, 2013 21:25
A Pen by Arthur Fanti.
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {