Skip to content

Instantly share code, notes, and snippets.

View samlovescoding's full-sized avatar
🔮
Building

Sampan Verma samlovescoding

🔮
Building
View GitHub Profile

https://stackoverflow.com/questions/8652948/using-port-number-in-windows-host-file

I managed to achieve this by using Windows builtin networking tool netsh.

As Mat points out: The hosts file is for hostname resolution only, so a combination of the two did the trick for me. Example Overview

example.app:80 | <--Link by Hosts File

@samlovescoding
samlovescoding / what-forces-layout.md
Created February 19, 2024 14:08 — forked from paulirish/what-forces-layout.md
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
630
10895
11224
567
11848
521
426
10882
2576
11571
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+n",
"command": "explorer.newFile"
},
{
"key": "ctrl+shift+n",
"command": "explorer.newFolder"
},
@samlovescoding
samlovescoding / extensions.bat
Last active January 12, 2021 18:36
Visual Studio Code Settings
code --install-extension anseki.vscode-color
code --install-extension bierner.color-info
code --install-extension bmewburn.vscode-intelephense-client
code --install-extension burkeholland.simple-react-snippets
code --install-extension dbaeumer.vscode-eslint
code --install-extension DigitalBrainstem.javascript-ejs-support
code --install-extension dracula-theme.theme-dracula
code --install-extension esbenp.prettier-vscode
code --install-extension formulahendry.auto-close-tag
code --install-extension formulahendry.auto-rename-tag
@samlovescoding
samlovescoding / lamp-stack.sh
Created August 9, 2020 00:44
Actually working Linux setup for PHP and MySQL.
# Update your system and its repositories
sudo apt-get update
sudo apt-get upgrade
# Install Apache Server
sudo apt-get install apache2
# Install MySQL Server
sudo apt-get install mysql-server
mysql_secure_installation
@samlovescoding
samlovescoding / package.json
Created June 27, 2020 06:15
Webpack for Electron and Vue
{
"name": "webpack-electron-vue",
"version": "1.0.0",
"description": "Boilerplate for Webpack Electron Vue App",
"main": "index.js",
"scripts": {
"start": "npm run build && npm run serve",
"build": "webpack --config webpack.config.js",
"watch": "webpack --config webpack.config.js --watch",
"serve": "electron ."
@samlovescoding
samlovescoding / pytor.py
Created May 31, 2020 01:43
Request Session with Tor
import requests
from stem import Signal
from stem.control import Controller
def get_tor_session():
session = requests.session()
session.proxies = {'http': 'socks5://127.0.0.1:9050',
'https': 'socks5://127.0.0.1:9050'}
return session
@samlovescoding
samlovescoding / index.html
Created April 18, 2020 17:02
UI Animating on Scroll: GSAP + ScrollMagic
<section>
<h1>Scroll down</h1>
</section>
<section class="sticky">
<blockquote>"You should totally subscribe to my channel now"<span></span></blockquote>
<img id="office" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/2621168/office1.png">
<img id="building" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/2621168/sky.jpg">
<div id="box"></div>
</section>
@samlovescoding
samlovescoding / pytmdb_expo.py
Created March 11, 2020 22:59
Python wrapper for tmdb API to transfer movies to Expo
# pip install tmdbsimple
# pip install requests
# python3 main.py
import tmdbsimple as tmdb
import json
import os
import requests
local = False