Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View spences10's full-sized avatar
💭
SvelteKit is bae!

Scott Spence spences10

💭
SvelteKit is bae!
View GitHub Profile
@antony
antony / fix-vercel.sh
Last active October 16, 2023 18:43
WASM dependency on Vercel
#!/bin/bash
VERCEL_OUTPUT_DIR=.vercel_build_output
LAMBDA_DIR=.vercel_build_output/functions/node/render/
cp -r static $LAMBDA_DIR/static
cp node_modules/sharp/build/Release/*.node $LAMBDA_DIR
cp node_modules/canvas/build/Release/*.node $LAMBDA_DIR
cp node_modules/sharp/vendor/8.11.3/linux-x64/lib/libvips-cpp.so.42 $LAMBDA_DIR
cp ./images.json $VERCEL_OUTPUT_DIR
sed -i 's#\.\./build/Release#\.#g' $LAMBDA_DIR/index.js
@antony
antony / deploy.sh
Last active September 7, 2023 09:01
Deploying Sapper to Vercel using Build Output v3 API
pnpm run build
cd __sapper__/build/
mkdir -p $PUBLIC_DIR/${{ inputs.base_path }}
mv client $PUBLIC_DIR/${{ inputs.base_path }}
cp -r ../../static/* $PUBLIC_DIR/
mkdir -p $LAMBDA_DIR
mv index.js server $LAMBDA_DIR/
mkdir -p $BUILD_DIR
mv service-worker.js template.html build.json $BUILD_DIR
cp ${{ github.workspace }}/vercel.json ./app/
export actions = {
prepyment: async ({ request }) => {
const formData = await request.formData()
const price = formData.get('price')
const email = formData.get('email')
const url = await generateCheckout(price, email)
return { success: true, url }
}
}
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
Based on mentalhealth.txt by @potatoqualitee:
https://gist.github.com/potatoqualitee/d873c10d8cc578c11fc2ea508bcb2501
## Politics ##
alt-right
Brexit
Capitol
CCP
China
CIA
/**
* proof of concept replacement for gatsby-remark-images
* to be used with gatsby-plugin-mdx
*
* this is mostly a copy/paste/edit from gatsby-remark-images
*/
const visitWithParents = require(`unist-util-visit-parents`);
const getDefinitions = require(`mdast-util-definitions`);
const path = require(`path`);
@tannerlinsley
tannerlinsley / remove-linkin-connections.js
Created July 12, 2019 15:43
A script for removing LinkedIn connections automatically
function removeFirstConnection () {
$('[type=ellipsis-horizontal-icon]').first().click()
setTimeout(() => {
$('.js-mn-connection-card__dropdown-delete-btn > button').click()
setTimeout(() => {
$('[data-control-name="confirm_removed"]').click()
}, 250)
}, 250)
}
@stolinski
stolinski / providerCompose.js
Created April 23, 2019 17:40
ProviderComposer
function ProviderComposer({ contexts, children }) {
return contexts.reduceRight(
(kids, parent) =>
React.cloneElement(parent, {
children: kids,
}),
children
);
}
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@antmdvs
antmdvs / ReactHooks.code-snippets
Last active November 7, 2018 17:51
Snippets for React's *EXPERIMENTAL* `useState()` hook -- See https://reactjs.org/hooks
{
"useState()": {
"prefix": "us",
"scope": "javascript,javascriptreact,typescript,typescriptreact",
"body": [
"const [${1}, set${1/(.*)/${1:/capitalize}/}] = useState($2);",
"$0"
],
"description": "React: useState()"
},