Skip to content

Instantly share code, notes, and snippets.

View blurymind's full-sized avatar

Todor Imreorov blurymind

View GitHub Profile
@red-dragon65
red-dragon65 / Deck ui.md
Last active February 21, 2024 16:26
How to properly run Steam Decks UI on Manjaro

This guide is deprecated! Please take a look at the alternative solutions below.

This guide was created to run the steam deck ui on a linux desktop before valve officially updated big picture mode for the steam client. This guide no longer serves any purpose.

Big Picture Mode

  • The steam client now officially uses the steam deck ui (gamepad ui) for big picture mode.

HoloISO

  • A reversed engineered version of valves steam deck OS
@MichaelPHolstein
MichaelPHolstein / script.js
Last active April 18, 2023 17:29
JavaScript file of background removal using Tensorflow and bodyPix
IMAGE_SRC = './img/8.jpg'
const loadImage = () => {
const img = new Image()
img.src = IMAGE_SRC
const canvas = document.querySelector('canvas')
const ctx = canvas.getContext('2d')
img.addEventListener('load', () => {
// Original code by Homer Chen
// https://github.com/homerchen19/use-undo
// Same as original but using useState instead of useReducer
import { useState, useCallback } from 'react';
const initialState = {
past: [],
present: null,
@johnhutchins
johnhutchins / middleNumberInBetweenTwoNumbers.js
Created October 8, 2019 18:06
Get the middle number between two numbers.
function middleInBetweenNumnbers(min, max) {
return Math.floor((max+min)/2);
}
@jeffposnick
jeffposnick / service-worker.js
Created September 20, 2019 00:56
Example of InjectManifest in Workbox v5
// Add any other logic here as needed.
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin';
import { CacheFirst } from 'workbox-strategies/CacheFirst';
import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL';
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin';
import { NavigationRoute } from 'workbox-routing/NavigationRoute';
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute';
import { registerRoute } from 'workbox-routing/registerRoute';
@nikolayemrikh
nikolayemrikh / bash.sh
Last active November 22, 2023 17:37
Calculate SHA-1 hash GitHub API v3 way
git hash-object ./file
# or
git hash-object -t blob
# or
cat ./file | git hash-object --stdin
@redblobgames
redblobgames / remove-alpha-on-canvas.js
Created September 19, 2018 20:41
Remove alpha channel on a canvas, so it's always transparent or always opaque
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const pixels = imageData.data;
for (let i = 3, n = canvas.width * canvas.height * 4; i < n; i += 4) {
pixels[i] = pixels[i] < 127? 0 : 255
}
ctx.putImageData(imageData, 0, 0);
@dndhm
dndhm / AppWithContext.js
Last active March 30, 2023 09:17
React Context.Consumer mocking
import React, { Component } from 'react';
import FruitContext from './FruitContext';
import FruityComponent from './FruityComponent';
export class App extends Component {
state = {
fruit: 'apple',
}
@jayphelps
jayphelps / package.json
Last active June 29, 2024 15:53
TypeScript output es2015, esm (ES Modules), CJS, UMD, UMD + Min + Gzip. Assumes you install typescript (tsc), rollup, uglifyjs either globally or included as devDependencies
{
"scripts": {
"build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min",
"build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015",
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs",
"build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js",
"build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments --o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz",
}
}