Skip to content

Instantly share code, notes, and snippets.


Jim Buck jimbuck

View GitHub Profile
jimbuck / buffered.ts
Created Nov 30, 2021
Creates a buffered function using RXJS.
View buffered.ts
import { Subject, fromEvent } from 'rxjs';
import { buffer, map, filter } from 'rxjs/operators';
function buffered<T>(handler: ((values: T[]) => Promise<void>)) {
const valueQueue = new Subject<T>();
const bufferTrigger = new Subject<void>();
let busy = false;
let destroyed = false;
const sub = valueQueue.pipe(
jimbuck / debug.css
Created Aug 25, 2021
Show debug data on a site.
View debug.css
.show-debug *[data-debug]::after {
content: attr(data-debug);
color: #f00;
position: absolute;
opacity: 0.1;
.show-debug *[data-debug]:hover::after {
opacity: 1;
jimbuck / setup-next-ts.bat
Last active Aug 30, 2019
Next.js Setup for TypeScript
View setup-next-ts.bat
npm init -y
npm i -P react react-dom next bootstrap react-bootstrap @zeit/next-css @zeit-next-less
npm i -D typescript @types/react @types/react-dom @types/node
npx npm-add-script -k dev -v next -f
npx npm-add-script -k build -v "next build" -f
npx npm-add-script -k start -v "next start" -f
mkdir pages
mkdir components
if [ -z "$version" ]; then
echo Must provide a version!
jimbuck / bump.ps1
Created Oct 4, 2017
Bump version of csproj
View bump.ps1
[string]$csproj = $(throw "-csproj is required."),
[ValidateSet('major', 'minor', 'patch')][string]$part = "patch"
Function BumpVersion([string]$csprojPath, [int]$majorInc, [int]$minorInc, [int]$patchInc) {
[xml]$xml = (Get-Content $csprojPath)
$buildInfo = $xml.Project.PropertyGroup | Where-Object {$_.Label -eq 'BuildInfo'}
#split product version in SemVer language
jimbuck / index.js
Created May 11, 2017
Get List of Media Devices (not streams)
View index.js
.then(devices => => `[${d.kind}] ${d.label}`))
jimbuck / WindowKeeper.cs
Last active May 3, 2016
Simple class that maintains the position and size of console windows when debugging in VS. Makes rapid debug cycles a little less frustrating.
View WindowKeeper.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Timers;
namespace CodeGear.Utilities
jimbuck / make64-bookmarklet.txt
Last active Dec 23, 2015
Converts the current image to the base64 equivalent.
View make64-bookmarklet.txt
javascript: !function(){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var e=new FileReader;e.onloadend=function(){,"_blank")},e.readAsDataURL(n.response)},"GET",window.location.href),n.send()}();
jimbuck / filegen
Created Dec 19, 2014
Bulk File Generator
View filegen
#!/usr/bin/env bash
barWidth=60 # constant
filePadding=8 # constant
extension="file" # constant
jimbuck / auto-cookies.js
Last active Aug 29, 2015
View auto-cookies.js
var bigCookie = document.getElementById('bigCookie');
var cookieClickers;
if(Notification.permission !== 'granted'){
Notification.requestPermission( function(status) {
} else {