Skip to content

Instantly share code, notes, and snippets.

View laszlo-horvath's full-sized avatar

László Horváth laszlo-horvath

View GitHub Profile
@laszlo-horvath
laszlo-horvath / jquery.stoc.js
Created May 17, 2012 15:18 — forked from goldsky/jquery.stoc.js
jQuery Plugin: Table of Contents with Smooth Scrolling
/**
* jQuery Plugin: Table of Contents with Smooth Scrolling
* @link http://www.1stwebdesigner.com/css/jquery-plugin-smooth-scrolling/
* @author Rochester Oliveira
*/
(function($){
$.fn.stoc = function(options) {
//Our default options
var defaults = {

Node.js project folder-structure

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@laszlo-horvath
laszlo-horvath / ReactPortal.js
Created June 15, 2022 14:40
React reusable Portal component
import { useEffect, useRef, memo } from 'react';
import { createPortal } from 'react-dom';
const Portal = ({ children }) => {
// Keeps ref between renders
const el = useRef(null);
// Create element if empty (for the first render only)
if (!el.current) el.current = document.createElement('div');