Skip to content

Instantly share code, notes, and snippets.

View cognivator's full-sized avatar

cognivator cognivator

View GitHub Profile
@cognivator
cognivator / Previewjs JetBrains Plugin Configuration For NEXTjs.md
Last active May 22, 2025 18:10
Previewjs JetBrains Plugin Configuration For NEXTjs

The culmination of multiple turns with Claude Desktop and MCP Servers for Sequential-Thinking, Desktop-Commander.

To understand this implementation and the problems it overcomes, refer to DEVTOOLS.md and README.md.

The files here are in a flat hierarchy, but their proper locations in a NEXT.js project are shown in __previewjs__README.md (which ultimately lands in the __previewjs__ folder.) DEVTOOLS.md can be placed anywhere in the project, but the root seems most useful.

DISCLAIMER

Standard disclaimer. This is a solution that worked for me. NO IMPLIED WARRANTY OR SUITABILITY TO PURPOSE. SUPPLIED AS-IS. Yada-yada (we've all seen this verbiage before).

@cognivator
cognivator / claude-mcp-npx-wrapper.md
Last active April 3, 2025 06:39
Configure Claude MCP for use with NVM

Claude MCP - with NVM

As documented by Jonathan Gastón Löwenstern (hereafter, JGL), loading Claude Desktop MCP servers while using Node Version Manager (NVM) can be fraught, and there is little assistance in the community. Thankfully, Jonathon describes and solves the problems.

My modification is the ability to configure and use an NVM alias for use with Claude MCPs, without hardcoding the node version.

Caveats: This is tested and known to work on MacOS Monterey with ZSH. I have not tried other flavors of MacOS, Linux, or shells.

The Strategy

@cognivator
cognivator / macos_multiple_SSH_keys.md
Last active March 28, 2024 19:32
Manage multiple SSH keys on MacOS

Situation

There are plenty of references for generating and using SSH keys on MacOS. Google for answers and they're everywhere. What is less obvious is how to use multiple SSH keys, especially for the same host, e.g. GitHub. I had multiple SSH keys and a ~/.ssh/config file, but certain of the credentials weren't being found.

Solution

The nuggets of goodness I found describe how to properly use ~/.ssh/config - (here, here, here, here... +many more). The key is actually using the resulting Host aliases!

Go figure, huh? 🤦

Example: Github - SourceTree

@cognivator
cognivator / .Insomnia_SalesforceAPI.md
Last active June 15, 2020 22:49
Insomnia template for Salesforce REST API with Oauth password flow

Install

Import the accompanying insomnia_salesforceAPI.json into Insomnia to create a workspace with sample requests that,

  • get a bearer token using Salesforce built-in Oauth password workflow
  • make REST API requests referencing the bearer token

Setup / Customize

Environment

The environment variables are stored in MyOrg folder.

@cognivator
cognivator / sourcetree_intellij_diffmerge.md
Last active September 19, 2019 23:43
Configure Sourcetree to use Intellij (Jetbrains) as external Diff or Merge tool

Summary

If the prescribed method of configuring Sourcetree using Jetbrains' command line scripts fails, here is an alternative configuration:

Diff

  • Diff Command: open -W -n -b "com.jetbrains.intellij" --args
  • Diff Arguments: diff "$LOCAL" "$PWD/$REMOTE"

Merge

  • Merge Command: open -W -n -b "com.jetbrains.intellij" --args
  • Merge Arguments: merge "$PWD/$LOCAL" "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$MERGED"
@cognivator
cognivator / git_fetch_by_hash
Created September 4, 2018 22:47
SourceTree Custom Action to FETCH the selected branch
#!/bin/bash
set -e
set -o pipefail
unset fetch_git_branch
fetch_git_branch=`git name-rev --refs=heads/* --name-only $1 | grep -oE '^[^~]+'`
echo fetching... $fetch_git_branch
@cognivator
cognivator / Hipchat_sort-and-display-people.md
Last active June 28, 2018 16:49
Hipchat - sort and display Rooms & People

Edit HipChat.app/Contents/Resources/chat.html

  1. In _getPeopleList, replace,
...
name: room.name
...

with,

// Assumes jwt-client has been loaded to define JWT global
(function expireJWT() {
JWT.defaults = {key: 'jwt', tokenPrefix: '', storage: window.localStorage, padding: false};
decodedJWT = JWT.read(JWT.get());
decodedJWT.claim.exp = (Date.now() / 1000) - 1;
JWT.keep(decodedJWT);
})();
@cognivator
cognivator / ui-router controller instantiation.md
Last active August 25, 2016 19:33
ui-router: testing for controller instantiation

Scenario

You're using ui-router to manage Angular 1.x routing states. You have a parent state that should always navigate to a child state, but without relying on ui-router-extras like $deepStateRedirect. This is to avoid deep linking into the child state. Some logins need to operate this way, for instance, so the Terms of Service acknowledgement cannot be skipped.

Configuration

This is an example ui-router state hierarchy that defines a series of states used for login pages.

$stateProvider
  .state('login', {
 url: '/login',