Skip to content

Instantly share code, notes, and snippets.

View rogueyoshi's full-sized avatar
🕹️
Focusing

Al Murray rogueyoshi

🕹️
Focusing
View GitHub Profile
@sastan
sastan / $layout.svelte
Last active January 15, 2023 00:15
sveltekit + urql (extended version)
<script context="module">
import { get, readable } from 'svelte/store'
import { createClient, operationStore } from '@urql/svelte'
import { browser, dev } from '$app/env'
/**
* @type {import('@sveltejs/kit').Load}
*/
Readme: In the following pseudo code, [] indicates a subroutine.
Sometimes I choose to write the subroutine inline under the [] in order to maintain context.
One important fact about the way rollbacks are handled here is that we are storing state for every frame.
In any real implementation you only need to store one game state at a time. Storing a game
state for every frame allows us to only rollback to the first frame where the predicted inputs don't match the true ones.
==Constants==
MAX_ROLLBACK_FRAMES := Any Positive Integer # Specifies the maximum number of frames that can be resimulated
FRAME_ADVANTAGE_LIMIT := Any Positive Integer # Specifies the number of frames the local client can progress ahead of the remote client before time synchronizing.
@marcusx2
marcusx2 / netlify.toml
Last active October 10, 2021 22:18
custom headers for brotli compression on a Unity WebGL project hosted on Netlify
[[headers]]
for = "/Build/*.data.br"
[headers.values]
Content-Encoding = "br"
Content-Type = "application/octet-stream"
[[headers]]
for = "/Build/*.wasm.br"
[headers.values]
Content-Encoding = "br"
@MPThLee
MPThLee / enableDiscordExperiments.js
Last active April 25, 2024 05:50
This code doesn't work anymore. I just decided to remove this code. You can check working code on comments.
/**
* !!!! This code doesn't work anymore !!!!
*
* - You can check working code on comments. I won't update this code anymore.
*
* Also, I just decided to remove this code. You can check revisions for old code.
* Since this code was made for discord client that almost 5 years ago, It seems like doesn't work anymore.
* I don't want people keep arguing in the comments, i decided to remove this code.
*
* Note: This code is now fulfilled with Javascript comments. This code won't work even if you pasted to console. doesn't do anything.
@torresalmonte
torresalmonte / index.js
Created October 16, 2018 17:43
Firebase Cloud Function using Cloud Vision API for safe search filter
const functions = require('firebase-functions');
const mkdirp = require('mkdirp-promise');
const gcs = require('@google-cloud/storage')();
const spawn = require('child-process-promise').spawn;
const path = require('path');
const os = require('os');
const fs = require('fs');
/**
* When an image is uploaded we check if it is flagged as Adult or Violence by the Cloud Vision
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
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
@LPGhatguy
LPGhatguy / luajit-curl.lua
Last active March 19, 2023 09:53
A cURL binding for LuaJIT. Missing some constants presumably, but functional
--[[
LuaJIT-cURL
Lucien Greathouse
LuaJIT FFI cURL binding aimed at cURL version 7.38.0.
Copyright (c) 2014 lucien Greathouse
This software is provided 'as-is', without any express
or implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
@JcMinarro
JcMinarro / adbIp.sh
Created August 20, 2014 10:40
Script to connect Android devices to ADB over tcpip
#/bin/bash
adb devices
echo "Waiting for device"
adb wait-for-device
ip=$(adb shell ifconfig wlan0 | cut -f3 -d ' ')
echo "Device ip: $ip"
echo "Setting Up tcpip port"
adb tcpip 5555
echo "Connecting to $ip"
adb connect $ip