Skip to content

Instantly share code, notes, and snippets.

View StefansArya's full-sized avatar
🎍
Sorry I usually focus on GitLab repo

StefansArya StefansArya

🎍
Sorry I usually focus on GitLab repo
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
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
@1duo
1duo / centos.install.cmake.from.source.md
Last active April 23, 2024 15:58
Install CMake on CentOS 7.

Download CMake from: https://cmake.org/download/

wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz

Compile from source and install

tar zxvf cmake-3.*
@justmoon
justmoon / custom-error.js
Last active April 22, 2024 17:19 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active April 21, 2024 12:50
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@hoandang
hoandang / apache-conf.md
Last active April 1, 2024 06:46
Sample vhost configuration

Sample apache vhost configuration

Udate /etc/hosts or c:\windows\system32\drivers\etc\hosts file so that the new servername is mapped to 127.0.0.1

Apache config file changes document root

    DocumentRoot "/Users/hoan/www"
<Directory "/Users/hoan/www">
    #

Possible values for the Options directive are "None", "All",

@tanaikech
tanaikech / submit.md
Created August 19, 2020 05:35
Converting Range in Google Spreadsheet as Image using Google Apps Script

Converting Range in Google Spreadsheet as Image using Google Apps Script

This is a sample script for converting a range in Google Spreadsheet as an image data using Google Apps Script. Unfortunately, there are no methods for directly converting the range in Google Spreadsheet as an image data in the built-in functions. So in this case, as a workaround, Charts Service is used.

Sample script

const range = "B5:D10";
const [header, ...values] = SpreadsheetApp.getActiveSheet()
 .getRange(range)
@omaraboumrad
omaraboumrad / wiki.md
Last active January 6, 2024 17:08
How to contribute to a GitHub Project's Wiki

Setup

Assuming project is SOME/PROJECT And you are FOO

You will need to do the following one time only:

@yujuiting
yujuiting / dynamic-load-uasset.cpp
Last active January 4, 2024 07:20
Unreal Engine 4: Dynamic load uasset
/*
load uasset from file path.
*/
FString filepath("/Game/an_animation_file"); // without extension, path start with `/Game`, `/Game` refer-> `Content` folder in real.
FStringAssetReference asset_stream_ref(filepath);
TAssetPtr<UAnimationAsset> animation_asset(asset_stream_ref);
UAnimationAsset* animation = animation_asset.LoadSynchronous();
bool isValid = animation_asset.IsValid();
bool isNull = animation_asset.IsNull();
bool isPending = animation_asset.IsPending();
@farhadi
farhadi / rc4.js
Created March 24, 2012 17:09
RC4 encryption in javascript and php
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';
@hacksalot
hacksalot / gist:72517b9b1c145116e89e
Created March 17, 2015 02:01
Delete GitHub wiki revisions
# Delete prior revisions from a GitHub wiki so that only the most-recent
# version of the content is available.
# Clone the wiki.
git clone https://github.com/[user]/[repo].wiki.git
# Remove the .git folder.
rm -rf .git
# Reconstruct the local repo with only latest content