Skip to content

Instantly share code, notes, and snippets.

View yanai101's full-sized avatar
🤩

yanai yanai101

🤩
  • israel
View GitHub Profile
@yanai101
yanai101 / webpack-config.js
Last active January 30, 2018 15:05
webpack config
const webpack = require("webpack");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const InterpolateHtmlPlugin = require("react-dev-utils/InterpolateHtmlPlugin");
const Hot = webpack.HotModuleReplacementPlugin;
const NamedPlugin = webpack.NamedModulesPlugin;
module.exports = (env = {}) => {
return { objectGoesHere };
@yanai101
yanai101 / test.js
Last active February 25, 2018 09:06
ts and js
{
test: /\.tsx?$/,
use: ["babel-loader","awesome-typescript-loader"],
},
{
use: [
{
loader: 'awesome-typescript-loader',
options: {
transpileOnly: true,
@yanai101
yanai101 / api.js
Last active December 2, 2018 09:03
express sse example
/// server ///
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.status(200).set({
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@yanai101
yanai101 / index.js
Last active July 30, 2019 12:49
run js with npx
#!/usr/bin/env node
console.log("hi all from gists");
@yanai101
yanai101 / node_nginx_ssl.md
Created April 7, 2020 20:04 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@yanai101
yanai101 / DynamicMethods.js
Last active July 22, 2020 06:23
build dynamic ststic class methods
class DynamicMethods{
constructor(action){
for (const key in action) {
DynamicMethods[`${key}`] = new Function(`cb`, `${action[key]}`);
}
}
}
const action = {
#!/usr/bin/env node
import { execSync } from "node:child_process";
const packages = {
claude: "@anthropic-ai/claude-code",
gemini: "@google/gemini-cli",
copilot: "@github/copilot",
codex: "@openai/codex",
};