Skip to content

Instantly share code, notes, and snippets.

View srttk's full-sized avatar
🏡
WFH

Sarath srttk

🏡
WFH
View GitHub Profile
@srttk
srttk / widget.md
Created February 6, 2025 05:40 — forked from AlexxNB/widget.md
Howto make no-depends widget on Svelte and load it on the page

We should have at least three files: 'Widget.svelte', 'rollup.config.js' and 'package.json':

  1. Our widget Widget.svelte:
<script>
	export let name;
</script>

<h1>Hello {name}!</h1>
@srttk
srttk / RUST.MD
Created February 4, 2025 17:11 — forked from Mefistophell/RUST.MD
How to Compile a Rust Program on Mac for Windows

Question: I want to compile my Rust source code for the Windows platform but I use macOS.

Solution:

  1. Install target mingw-w64: brew install mingw-w64
  2. Add target to rustup: rustup target add x86_64-pc-windows-gnu
  3. Create .cargo/config
  4. Add the instructions below to .cargo/config
[target.x86_64-pc-windows-gnu]
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
"theme": "Catppuccin Latte",
@srttk
srttk / esm-package.md
Created October 22, 2024 05:02 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@srttk
srttk / nodejs-cicd-github-actions.md
Created August 28, 2024 14:16 — forked from danielwetan/nodejs-cicd-github-actions.md
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@srttk
srttk / client.js
Created February 23, 2023 09:04 — forked from mattfysh/client.js
urql + auth-exchange + aws-amplify
import { makeOperation } from '@urql/svelte'
import { authExchange } from '@urql/exchange-auth'
import { Auth } from 'aws-amplify'
import produce from 'immer'
import { set } from 'lodash'
const amplifyAuthExchange = authExchange({
addAuthToOperation: ({ authState, operation }) => {
if (!authState?.token) {
return operation
@srttk
srttk / example.png
Created September 20, 2022 06:50 — forked from charlesrt/example.png
Job Posting Standard
example.png
@srttk
srttk / download_egghead_videos.md
Created November 21, 2021 15:12 — forked from ldong/download_egghead_videos.md
download egghead videos

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});
/* Conditional */
SELECT product_id, language_code, name, custom_name, description, short_description FROM product_translations
WHERE product_id=16741 AND
language_code = SELECT IF ((SELECT COUNT(*) FROM product_translations WHERE product_id=16741), 'es', 'en_US');
/*With Join*/
ELECT DISTINCT pro.product_id, pcr.category_id,pro.product_sku,
@srttk
srttk / LICENCE SUBLIME TEXT
Created February 23, 2019 17:26
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----