Skip to content

Instantly share code, notes, and snippets.

View sadeghbarati's full-sized avatar
🤨

Sadegh Barati sadeghbarati

🤨
  • Iran, Mashhad
  • 03:04 (UTC +03:30)
View GitHub Profile
@sadeghbarati
sadeghbarati / index.js
Created August 14, 2021 06:14 — forked from iamakulov/index.js
Webpack’s externals work with local paths too
// my-app/webpack.config.js
{
externals: {
'jquery': 'jQuery',
/* ↑ With this line, Webpack will replace every
* import $ from 'jquery';
*
* in your code with approximately
* const $ = window.jQuery;
*
@sadeghbarati
sadeghbarati / setting-up-html-storybook-app.md
Created November 3, 2021 20:16 — forked from bessfernandez/setting-up-html-storybook-app.md
How to setup a simple Storybook HTML demo app

icon-storybook-default

Storybook for HTML

Storybook is all about writing stories. A story usually contains a single state of one component, almost like a visual test case.

Typically you see Storybook used for React or other frameworks, but the library has recently introduced the option to use HTML for your Storybook projects. As a prototyping tool or playground this is great! No larger scale knowledge of other frameworks needed.

Install Storybook HTML

// This file is based on the code from the ASP.NET Core repository
// https://github.com/aspnet/AspNetCore/tree/master/src/Middleware/SpaServices.Extensions/src
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
@sadeghbarati
sadeghbarati / gist:d9944790d05e6693e42e89ef4183d7bb
Created March 17, 2022 19:44 — forked from Prezens/gist:f99fd28124b5557eb16816229391afee
Apache .htaccess settings for Vue, vue-router
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations
@sadeghbarati
sadeghbarati / github-proxy-client.js
Created April 14, 2022 10:10 — forked from DavidWells/github-proxy-client.js
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@sadeghbarati
sadeghbarati / api_generator.js
Created April 14, 2022 10:11 — forked from v1vendi/api_generator.js
REST API functional generator
const fetch = (...args) => console.log(...args) // mock
function httpRequest(url, method, data) {
const init = { method }
switch (method) {
case 'GET':
if (data) url = `${url}?${new URLSearchParams(data)}`
break
case 'POST':
case 'PUT':
case 'PATCH':
@sadeghbarati
sadeghbarati / gist:3b0be6f7b55a8c8e6e9b8ec7dfbadd52
Created May 17, 2022 13:26 — forked from ayamflow/gist:b602ab436ac9f05660d9c15190f4fd7b
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@sadeghbarati
sadeghbarati / JavaScript GUI libraries.md
Created June 14, 2022 10:51 — forked from SMUsamaShah/List of JavaScript GUI libraries.md
dat.gui alternatives to create GUI from JavaScript object

JavaScript GUI libraries

These libraries can be used to quickly create a GUI for configureable parameters using sliders, checkboxes, colors pickers etc

  1. Tweakpane https://github.com/cocopon/tweakpane Demo: https://cocopon.github.io/tweakpane/
  2. control-panel https://github.com/freeman-lab/control-panel
  3. ControlKit https://github.com/automat/controlkit.js
  4. guify https://github.com/colejd/guify Main site is down, here is the demo https://jons.website/projects/guify/index
  5. oui https://github.com/wearekuva/oui
  6. Palette.js https://github.com/lehni/palette.js
@sadeghbarati
sadeghbarati / npm-prerelease.md
Created June 19, 2022 08:22 — forked from schmich/npm-prerelease.md
Publish a prerelease package to NPM
  • Update package.json, set version to a prerelease version, e.g. 2.0.0-rc1, 3.1.5-rc4, ...
  • Run npm pack to create package
  • Run npm publish <package>.tgz --tag next to publish the package under the next tag
  • Run npm install --save package@next to install prerelease package
@sadeghbarati
sadeghbarati / npm-canary.md
Created June 19, 2022 08:22 — forked from zephraph/npm-canary.md
Publish a canary package on NPM
  • Update package.json by running yarn version --prerelease --preid=canary
  • Run npm publish --tag canary to publish the package under the canary tag
  • Run yarn add @artsy/reaction@canary to install canary package

Running npm dist-tag ls can be helpful to see what tagged packages are available