Skip to content

Instantly share code, notes, and snippets.

View WickyNilliams's full-sized avatar

Nick Williams WickyNilliams

View GitHub Profile
@WickyNilliams
WickyNilliams / LICENSE
Last active May 10, 2022 15:22
formdata event polyfill
The MIT License (MIT)
Copyright (c) 2021 Nick Williams (https://wicky.nillia.ms)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
@WickyNilliams
WickyNilliams / generate-ssh-key.sh
Last active December 3, 2018 10:40 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@WickyNilliams
WickyNilliams / index.js
Last active November 30, 2018 17:36
@react-pdf/renderer without jsx
const React = require("react");
const { default: ReactPDF } = require("@react-pdf/renderer");
const {
Page,
Text,
View,
Document,
StyleSheet
} = require("@react-pdf/renderer");
@WickyNilliams
WickyNilliams / README.md
Last active September 24, 2020 11:01
So you want to publish a react component?!

So you want to publish a react component?!

This is a quick guide of what you need to do to publish a react component for use by others. This guide is distilled from a conversation [0] on twitter. I will reference individual tweets, where appropriate (thereby shifting blame for incorrect advice from me to the authors :D)

Assumptions

  1. You are using some sort of module system in your source
  2. You have a build step
  3. You want broad support for your component (browser-ready, npm compatible, consumable by bower)
const ENTITY_REGEX = /&#x([0-9A-F]+);/gi
function entityToChar(substr: string, match: string) {
return String.fromCharCode(parseInt(match, 16))
}
export const HtmlEntity = {
decode: function (str: string) {
return str.replace(ENTITY_REGEX, entityToChar)
},
@WickyNilliams
WickyNilliams / bad.js
Last active January 30, 2020 17:46
fast builds with grunt and browserify
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
paths : {
src : "<%= pkg.main %>",
@WickyNilliams
WickyNilliams / bootable.sh
Last active August 29, 2015 14:02
bootable ISO
# Convert the .iso file to .img using the convert option of hdiutil
hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/target.iso
# clean up extension
mv ~/path/to/target.img.dmg ~/path/to/target.img
# Get the current list of devices.
diskutil list
# Insert your flash media.
@WickyNilliams
WickyNilliams / index.html
Last active February 22, 2023 15:07
parseTable.js - convert HTML table to array of objects. MIT licensed (https://opensource.org/licenses/MIT)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>parseTable</title>
</head>
<body>
<table>
<thead>
<tr>
@WickyNilliams
WickyNilliams / bind.js
Last active December 6, 2020 15:30
Super simple one-way data-binding
/**
* follows a path on the given data to retrieve a value
*
* @example
* var data = { foo : { bar : "abc" } };
* followPath(data, "foo.bar"); // "abc"
*
* @param {Object} data the object to get a value from
* @param {String} path a path to a value on the data object
* @return the value of following the path on the data object
git log --graph --pretty=format:"%C(yellow)%h%Creset -%C(blue)%d%Creset %s %Cgreen(%cr)%Creset %C(dim white)%an%C(reset)"