Skip to content

Instantly share code, notes, and snippets.

View robatwilliams's full-sized avatar

Robat Williams robatwilliams

View GitHub Profile
@robatwilliams
robatwilliams / require.intellisense.js
Last active February 12, 2024 00:02
Hacking require.intellisense.js so that Intellisense still works in modules that also have text resources loaded via the text plugin.
/// <reference path="require.js" />
!function (window) {
var defines = [],
moduleUrls = [],
oldDefine = window.define,
oldRequire = window.require,
oldLoad = requirejs.load;
var loadEvent = document.createEvent("event");
@robatwilliams
robatwilliams / useful-names.md
Last active March 29, 2023 12:32
List of names that tend to be useful in programming

Useful names

List of names that tend to be useful in programming. On their own, or for building names.

A thesaurus is also useful.

Things

  • action, operation
  • attribute, property
  • buffer, queue
@robatwilliams
robatwilliams / build.targets
Last active March 23, 2022 00:44
Get the names of directories under a specified directory in MSBuild
<PropertyGroup>
<ParentDir>$(MSBuildProjectDirectory)\some\folder</ParentDir><!-- This folder has subfolders folders a, b, c-->
</PropertyGroup>
<Target>
<ItemGroup>
<SubfolderFullPaths Include="$([System.IO.Directory]::GetDirectories('$(ParentDir)'))" />
<SubfolderNames Include="@(SubfolderFullPaths->'$([System.IO.Path]::GetFileName('%(SubfolderFullPaths.Identity)'))')" />
</ItemGroup>
@robatwilliams
robatwilliams / HtmlModuleScriptWebpackPlugin.js
Created December 3, 2017 23:25
Plugin to create HTML page which loads ES5 or ES6 build according to browser capability
const { concat, mapKeys, merge, uniq } = require('lodash');
/**
* Tweaked from original by Mike Engel
* https://github.com/jantimon/html-webpack-plugin/issues/782#issuecomment-331229728
*
* Use this with multiple Webpack configurations that generate different builds
* for modern and legacy browsers. But use the same instance of the plugin in both configurations.
*
* It keeps track of assets seen in each build configuration, and appends script tags for
@robatwilliams
robatwilliams / .bashrc
Last active August 19, 2020 13:38
Auto-launching ssh-agent for GitHub on Git Bash in Windows. Minor modification from what's given at https://help.github.com/articles/working-with-ssh-key-passphrases
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
. "$SSH_ENV" > /dev/null
@robatwilliams
robatwilliams / compound-words-case-style.md
Last active June 23, 2020 09:12
Compound words and programming case styles

Compound words and programming case styles

A compound word is formed by joining together two or more other words.

A closed-form compound word (e.g. keyboard) does that without any additional punctuation. These are truly words in their own right, and so should be treated as such when applying programming casing conventions such as camelCase, PascalCase, kebab-case, or snake_case.

Open-form (e.g. living room) and hyphenated-form (e.g. long-term) compound words are less susceptible to incorrect casing.

Examples of incorrect camelCase

@robatwilliams
robatwilliams / github-backup.sh
Last active April 12, 2020 16:55
Backup GitHub repositories as Git bundles
#!/usr/bin/env bash
declare -a repositories=(
'awesome-webhid'
'config'
'correct'
'decent-code'
'diff-hero'
'differential-loading-poc'
'enforce-frontend-architecture'
@robatwilliams
robatwilliams / expected.txt
Created December 19, 2017 14:11
Check expected & unexpected HTTP headers
HTTP/1.1 200 OK
Content-Encoding: gzip
@robatwilliams
robatwilliams / webpack.blocks.js
Created November 28, 2018 09:54
Organising webpack config
const dependencyCssRule = {
};
function sassRule(options) {
return {
test: 1,
use: [
// use options.prod to turn off sourcemaps
// use options.prod to set sass outputStyle compressed/not