Skip to content

Instantly share code, notes, and snippets.

View sadeghbarati's full-sized avatar
🤨

Sadegh Barati sadeghbarati

🤨
  • Iran, Mashhad
  • 16:58 (UTC +03:30)
View GitHub Profile
$.fn.select2.amd.define('select2/data/extended-ajax',['./ajax','./tags','../utils','module','jquery'], function(AjaxAdapter, Tags, Utils, module, $){
function ExtendedAjaxAdapter ($element,options) {
//we need explicitly process minimumInputLength value
//to decide should we use AjaxAdapter or return defaultResults,
//so it is impossible to use MinimumLength decorator here
this.minimumInputLength = options.get('minimumInputLength');
this.defaultResults = options.get('defaultResults');
ExtendedAjaxAdapter.__super__.constructor.call(this,$element,options);
@sadeghbarati
sadeghbarati / reset.css
Created June 20, 2022 18:18 — forked from EllyLoel/reset.css
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@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

@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 / 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 / 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 / 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 / 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 / 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
// 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;