Skip to content

Instantly share code, notes, and snippets.

View zackify's full-sized avatar

Zach Silveira zackify

View GitHub Profile
// Async tool with external API call
server.registerTool(
"fetch-weather",
{
title: "Weather Fetcher",
description: "Get weather data for a city",
},
async () => {
const result = await server.server.elicitInput({
message: `No tables available. Would you like to check alternative dates?`,
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer(
{
name: "My MCP",
version: "1.0.0",
},
{
capabilities: {
import { useDispatch } from 'react-redux'
import someAction from 'actions/someAction'
export const useSomeAction = () => {
let {setToast} = useJessesContext()
const dispatch = useDispatch()
return ({message, someOtherActionDataIneed}) => {
dispatch(
someAction({setToast, message, someOtherActionDataIneed})
if (typeof window === 'undefined') {
global.window = new Proxy(
{},
{
get: (_, key) => {
// may need to add new stuff here to account for other method types
return () => global.window;
},
set: target => console.log(target),
}
return (
<div>
<Header />
<Products />
<AddToCart />
<Footer />
</div>
)
@zackify
zackify / Test.js
Created May 10, 2020 01:30
Example loading module vs no module
(function(d) {
var script = d.createElement("script");
script.type = "text/javascript";
script.text =
'import("https://passwordless.app/account/module/integrated.js");window.supportsDynamicImport = true;';
d.getElementsByTagName("head")[0].appendChild(script);
var script2 = d.createElement("script");
script2.type = "text/javascript";
//map and use Form over and over, add a button to add another field to state. All up to you
//Form doesn't render a form element, this way it works in rn and web, and wherever else.
// you can wrap all of them in one if you want.
const App = () => {
let [values, setValues] = React.useState([{name: 'test'}])
return values.map((value, index) => (
<Form
values={values}
# set the version from an env variable in ios
/usr/libexec/Plistbuddy -c "Set CFBundleShortVersionString $BUILD_NUMBER" "ios/cnnrnv2/Info.plist"
#in android, app/build.gradle
# versionName = System.env.BUILD_NUMBER
@zackify
zackify / gist:acf19f6ca0f8be13fb90
Last active January 14, 2020 15:06
Visually see react elements
setInterval(function() {
Array.prototype.slice.call(document.querySelectorAll('[data-reactid]'))
.forEach(function(element) {
element.style.background = 'rgba(255,0,0,0.1)';
})
}, 500)
@zackify
zackify / docker-compose.yml
Created April 15, 2018 18:17
Quickstart gutenblock (docker-compose up and it will sync blocks folder)
version: '3.3'
services:
db:
image: mysql:latest
volumes:
- dbdata:/var/lib/mysql
restart: always
ports:
- "3306:3306"