Skip to content

Instantly share code, notes, and snippets.

View asvny's full-sized avatar
🎯
Focusing

Annamalai Saravanan asvny

🎯
Focusing
View GitHub Profile
@itsMapleLeaf
itsMapleLeaf / example.tsx
Last active February 15, 2023 12:32
SolidStart-style server actions in Remix
function CreateTodoButton() {
const submit = CreateTodoAction.useSubmit()
const isSubmitting = CreateTodoAction.useSubmissions().length > 0
const params = useParams()
return (
<button
type="button"
title="Create Todo"
disabled={isSubmitting}
import SwiftUI
import SafariServices
import PlaygroundSupport
// lil news api
let apiURL = "https://api.lil.software/news"
struct News: Codable {
var articles: [Article]
}
Rank Type Prefix/Suffix Length
1 Prefix my+ 2
2 Suffix +online 6
3 Prefix the+ 3
4 Suffix +web 3
5 Suffix +media 5
6 Prefix web+ 3
7 Suffix +world 5
8 Suffix +net 3
9 Prefix go+ 2
#!/bin/bash
function lazy_nvm {
unset -f nvm
unset -f npm
unset -f node
unset -f npx
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # linux
@bcnzer
bcnzer / worker.js
Created October 15, 2018 09:31
Cloudflare Worker that uses Workers KV to get Authorization data. All authentication and authorization is done on the edge
addEventListener('fetch', event => {
event.respondWith(handleRequest(event))
})
/**
* Entry point of the worker
*/
async function handleRequest(event) {
try {
// Get the JWT
@bcnzer
bcnzer / cloudflareworker-verifyjwt.js
Last active July 2, 2024 10:18
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
@sorenlouv
sorenlouv / replace-webpack-alias-with-relative-path.js
Created April 29, 2018 17:18
Replace webpack aliases with relative paths
// Usage: jscodeshift -t replace-webpack-alias-with-relative-path.js ./kibana/x-pack/plugins ./kibana/src
const path = require('path');
const URI = require('urijs');
function getRelativePath(currentFilePath, dependencyPath) {
return URI(dependencyPath)
.relativeTo(currentFilePath)
.toString();
}
@kamleshchandnani
kamleshchandnani / reactiveconf-2017-progressive-loading-cfp.md
Last active June 29, 2020 08:22
Progressive loading for modern web applications via code splitting!
@journeymanavi
journeymanavi / production-web-server-setup-and-deployment-guide.md
Last active March 30, 2025 21:04
A runbook for setting up a Linux based secure, production web server, for serving static web content as well as deploying Node.js based web applications.
@myshov
myshov / function_invocation.js
Last active August 19, 2024 12:23
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);