Skip to content

Instantly share code, notes, and snippets.

View merin83's full-sized avatar
☀️
Creating New Things

Md. Estiak Ahmmed (Merin) merin83

☀️
Creating New Things
View GitHub Profile
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@ryanatkn
ryanatkn / tsconfig.json
Last active April 27, 2024 22:35
A TypeScript 3.5 tsconfig.json with all options organized and with documentation comments
{
// Commented-out options have their default values.
"include": ["src/**/*"],
"exclude": ["node_modules/*"],
// "files": [], // A list of relative or absolute file paths to include.
// "extends": "", // A string containing a path to another configuration file to inherit from.
// "references": [], // An array of objects `{"path": "./to/dirOrConfig"}` that specifies projects to reference.
// "compileOnSave": false, // Signals to the IDE to generate all files for a given tsconfig.json upon saving.
"compilerOptions": {
@bvaughn
bvaughn / index.md
Last active June 16, 2024 21:50
How to use profiling in production mode for react-dom

React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.

Table of Contents

Profiling in production

React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.

@bvaughn
bvaughn / index.md
Last active April 3, 2024 07:41
Interaction tracing with React

This API was removed in React 17


Interaction tracing with React

React recently introduced an experimental profiler API. After discussing this API with several teams at Facebook, one common piece of feedback was that the performance information would be more useful if it could be associated with the events that caused the application to render (e.g. button click, XHR response). Tracing these events (or "interactions") would enable more powerful tooling to be built around the timing information, capable of answering questions like "What caused this really slow commit?" or "How long does it typically take for this interaction to update the DOM?".

With version 16.4.3, React added experimental support for this tracing by way of a new NPM package, scheduler. However the public API for this package is not yet finalized and will likely change with upcoming minor releases, so it should be used with caution.

@gaearon
gaearon / index.html
Last active February 13, 2024 09:46
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@zackify
zackify / docker-compose.yml
Created April 15, 2018 18:17
Quickstart gutenblock (docker-compose up and it will sync blocks folder)
version: '3.3'
services:
db:
image: mysql:latest
volumes:
- dbdata:/var/lib/mysql
restart: always
ports:
- "3306:3306"
// something like:
<BundleLink to="/profile" onLoadStart={() => {
// throw a spinner up on the "old" page while we load
this.setState({ navigating: true })
}}>Profile</BundleLink>
<BundleLink to="/dash" prefetch={true}>Dashboard</BundleLink>
///////////////////////////////////////////////////////
const BUNDLED_ROUTES = {
@tarex
tarex / k-NN.adoc
Created February 15, 2017 22:15 — forked from nicolewhite/k-NN.adoc

Movie Recommendations with k-Nearest Neighbors and Cosine Similarity


Introduction

The k-nearest neighbors (k-NN) algorithm is among the simplest algorithms in the data mining field. Distances / similarities are calculated between each element in the data set using some distance / similarity metric ^[1]^ that the researcher chooses (there are many distance / similarity metrics), where the distance / similarity between any two elements is calculated based on the two elements' attributes. A data element’s k-NN are the k closest data elements according to this distance / similarity.


1. A distance metric measures distance; the higher the distance the further apart the neighbors. A similarity metric measures similarity; the higher the similarity the closer the neighbors.
@tarex
tarex / fontawesome.js
Last active September 29, 2016 10:37
font awesome grabbing from dom
var all = [];
jQuery('#icons section').each(function(index, section) {
var id = jQuery(this).attr('id');
jQuery('#'+ id + ' a').each(function(index, iconrow) {
all.push({
name: jQuery(this).text().replace('Example of','').replace(/^\s+/g, ""),
className: jQuery(this).children('i').attr('class')
});
});
});