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
@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)
@stemar
stemar / vardump.php
Created September 15, 2019 05:52
PHP var_dump() without newline after =>
<?php
/**
* PHP var_dump() without newline after => .
*
* NOTE: The only issue is when a string value has `=>\n[ ]+`, it will get converted to `=> `
* @link https://www.php.net/manual/en/function.var-dump.php
*/
function vardump($value, $return=FALSE) {
ob_start();
var_dump($value);
@codesections
codesections / actix-web.rs
Created December 20, 2018 22:03
Basic static file server with actix-web
extern crate actix_web;
use actix_web::{fs, server, App};
fn main() {
server::new(|| {
App::new()
.handler(
"/",
fs::StaticFiles::new("./public")
.unwrap()
@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.*
@ColonelBundy
ColonelBundy / Node.JS 8.9.4 - V8 6.1.534.50
Last active September 12, 2023 15:54
Promise vs Callback vs Async/await benchmark 2018
Doxbee sequential
benchmarking ./doxbee-sequential/async-bluebird.js
{"time":428,"mem":60.38671875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/async-es2017-native.js
{"time":591,"mem":98.82421875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/async-es2017-util.promisify.js
{"time":479,"mem":69.7734375,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/callbacks-baseline.js
{"time":149,"mem":29.99609375,"errors":0,"lastErr":null}
@iONinja
iONinja / uws.cpp
Last active April 18, 2020 04:53
An example of using µWebSockets in a C++ server
#include <uWS/uWS.h>
#include <iostream>
unsigned long getTime();
int main(int argc, char *argv[]) {
uWS::Hub h;
h.onMessage([](uWS::WebSocket<uWS::SERVER> *ws, char *data, size_t length, uWS::OpCode opCode) {
@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

@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();
@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:

@paulirish
paulirish / what-forces-layout.md
Last active April 26, 2024 17:33
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