Skip to content

Instantly share code, notes, and snippets.

View sadeghbarati's full-sized avatar
🍉

Sadegh Barati sadeghbarati

🍉
  • Iran, Mashhad
  • 06:25 (UTC +03:30)
View GitHub Profile
@staltz
staltz / introrx.md
Last active July 13, 2025 10:33
The introduction to Reactive Programming you've been missing
@whizark
whizark / class-naming-convention.md
Last active June 8, 2025 16:25
HTML/CSS Class Naming Convention #html #css #sass
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active July 11, 2025 21:46
The best FRP iOS resources.

Videos

@ghinda
ghinda / object-to-form-data.js
Last active May 13, 2025 05:55
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@paulirish
paulirish / bling.js
Last active May 26, 2025 20:31
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@B-iggy
B-iggy / inline-svg-function.scss
Last active December 13, 2020 11:53
Inline SVG function [SASS]
// set svg d path used as fallback (star)
$svg-d-path: 'm25,1l6,17l18,0l-14,11l5,17l-15,-10l-15,10l5,-17l-14,-11l18,0l6,-17z' !default;
// functions to urlencode the svg string
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
@paulirish
paulirish / what-forces-layout.md
Last active July 10, 2025 08:36
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@FUNExtreme
FUNExtreme / YouTube_auto_subscriber.js
Last active February 20, 2025 03:44
YouTube Auto Subscriber which can be used to transfer your subscriptions from one account to another.
/*
* DESCRIPTION
* This script will go through all the subscription buttons on the YouTube page you execute it on, and subscribes to the ones that
* you're not subscribed to yet.
* A random delay is added to each subscription request, this is due to the fact that YouTube starts blocking subscriptions after
* a certain number of consecutive requests. Randomising the delays should trick the detection into thinking it's a valid user doing
* the requests.
*
* HOW TO USE
* Navigate to the page containing the channels you would like to subscribe to. (The subscribe button should be visible!)
@seblambla
seblambla / getTotalLength.js
Created November 16, 2015 10:33
getTotalLength() equivalent for circle, rect, polygon and line shapes.
/*
Author: ZetCoby
http://stackoverflow.com/a/30376660/3708754
*/
var tools = {
/**
*
* Used to get the length of a rect
*
@coryhouse
coryhouse / package.json
Last active November 9, 2023 06:04
Example of pre and post scripts in package.json
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"prebuild": "echo I run before the build script",
"build": "cross-env NODE_ENV=production webpack",
"postbuild": "echo I run after the build script"
}
}