Skip to content

Instantly share code, notes, and snippets.

🍑
Peachy

Nerdyman nerdyman

🍑
Peachy
  • Newcastle Upon Tyne
Block or report user

Report or block nerdyman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View README.md
@nerdyman
nerdyman / README.md
Last active Jul 3, 2019
Prompt a File Download and respect the Content Disposition Header Using Fetch and FileSaver
View README.md

Prompt a File Download With the Content Disposition Header Using JavaScript

Set the Server Response Headers

Expose the Content-Disposition header using the Access-Control-Expose-Headers header and set the Content-Disposition header as you would usually.

Access-Control-Expose-Headers: Content-Disposition
Content-Disposition: attachment; filename="example-file.csv"
@nerdyman
nerdyman / fix-docker-dns.md
Last active Apr 22, 2020
Fix docker DNS not working on Linux hosts
View fix-docker-dns.md

Docker DNS issues on systemd distros

(Hopefully) fix Docker DNS issues with systemd distros, e.g. ping: bad address 'google.com', Temporary failure resolving ... (tested on Arch).

Checklist

  1. Host DNS is correct (/etc/resolv.conf) and does not contain any invalid nameservers
  2. Ensure DNS resolves correctly (dig google.com @ipaddress.from.resolvconf.here)
  3. Ensure Docker container has same config as host docker run -it <your-image> cat /etc/resolv.conf
@nerdyman
nerdyman / README.md
Last active Dec 3, 2018
GTA V Working on Steam Play (Proton) on Arch Linux and proprietary Nvidia drivers
View README.md

Steps for Arch Linux w/ Nividia proprietary driver

  • Install wine-staging (pacman -S wine-staging)
  • Install the latest Nvidia drivers (pacman -S nvidia-dkms nvidia-utils lib32-nvidia-utils)
  • Create a GTA DXVK config file [1]
  • Set GTA 5 launch option in Steam to DXVK_CONFIG_FILE=/<PATH_TO_YOUR_CONFIG>/gta_dxvk.conf %command%
  • Copy steam/steamapps/common/Proton 3.7/user_settings.sample.py to steam/steamapps/common/Proton 3.7/user_settings.py
    • Uncomment "PROTON_NO_ESYNC": "1" in user_settings.py
  • Copy all Windows fonts from a Windows ISO to /usr/share/fonts/WindowsFonts OR install ttf-ms-win10 from the AUR
  • Run fc-cache -vfr to rebuild the font cache
@nerdyman
nerdyman / ppi-calcuation.md
Created Nov 9, 2017
Calculate the PPI of an image
View ppi-calcuation.md

PPI Calculation

Variables

  • ppi as int
  • pageResolution in px
  • imageResolution in px
  • pageSize in inches

Sample values

@nerdyman
nerdyman / resolve-tsconfig-path-to-webpack-alias.js
Last active May 14, 2020
Convert TypeScript tsconfig paths to webpack alias paths
View resolve-tsconfig-path-to-webpack-alias.js
const { resolve } = require('path');
/**
* Resolve tsconfig.json paths to Webpack aliases
* @param {string} tsconfigPath - Path to tsconfig
* @param {string} webpackConfigBasePath - Path from tsconfig to Webpack config to create absolute aliases
* @return {object} - Webpack alias config
*/
function resolveTsconfigPathsToAlias({
tsconfigPath = './tsconfig.json',
@nerdyman
nerdyman / contrast.less
Created Jun 1, 2016
LESS contrast mixin - contrast mixin for LESS which works likes you'd expect it to
View contrast.less
/**
* contrast.less
* the built-in contrast() function in LESS sucks, this one works
* calculates the perceptual brightness of a color and assigns an int value to it
* to determine whether contrasting color should be dark or light
*
* usage:
* #contrast(@color: #f00; @threshold: 43; @dark: #222; @light: #eee; @more: '!important');
*
* using specific params:
You can’t perform that action at this time.