Skip to content

Instantly share code, notes, and snippets.

View ASafaeirad's full-sized avatar
🎯
Focusing

Alireza Safaierad ASafaeirad

🎯
Focusing
View GitHub Profile
{
"remove-empty-rulesets": false,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": false,
"quotes": "single",
@ASafaeirad
ASafaeirad / graphql-jest-transform.js
Created April 28, 2018 11:22
Graphql Jest Transform, Preprocess graphql files and resolve imports for integration testing in jest. (work fine with webpack-graphql-loader)
const fs = require('fs');
const path = require('path');
const getLines = file => file.split(/(\r\n|\r|\n)/);
const filterComments = lines => lines.filter(line => line[0] === '#');
const filterImports = lines => lines.filter(line => line.slice(1).split(' ')[0] === 'import');
const getImportPathes = lines => lines.map(line => line.slice(1).split(' ')[1]);
const getValidPathes = pathes => pathes.map(_path => _path && _path.match(/^["'](.+)["']/)[1]);
const resolveImportPathes = (importPathes, srcPath) =>
importPathes.map((importPath) => {
@ASafaeirad
ASafaeirad / 99-custom-keyboard.conf
Created November 27, 2018 15:08
Replace capslock with escape
Section "InputClass"
Identifier "keyboard defaults"
MatchIsKeyboard "on"
Option "XKbOptions" "caps:escape"
EndSection
:root {
--command-mode-width: 15px;
--c-bg: #29353B;
--c-bg-link: var(--c-bg);
--c-fg-link: #fff;
--c-fg: #fff;
--c-muted: #8f8f8f;
--c-bg-active: #2DCED0;
--c-fg-active: #00fcff;
--s-link-width: 22px;
@ASafaeirad
ASafaeirad / typeDecorator.js
Created June 12, 2019 22:53
Javascript dynamic type system decorator
const typeDecorator = (type) =>
(target, key, descriptor) => {
let value;
return {
enumerable: true,
get: function () { return value; },
set: function (newValue) {
const newType = typeof newValue;
if (newType !== type || newType === 'undefined') {
@ASafaeirad
ASafaeirad / theme.js
Last active August 31, 2019 09:28
Carbon fullstacks theme
var icons = {
fullstacks: `
<svg width="24" height="42" viewBox="0 0 24 42" class="logo">
<path d="M11.1427 6L0 25.4405L11.1427 36L22.2857 25.4405L11.1427 6ZM11.1427 30.0935L5.5134 24.5712L11.1427 14.7402L16.772 24.5712L11.1427 30.0935Z" fill="#D9D9D9"></path>
<path d="M11.1427 14.7421L5.5134 24.5734L0 25.4427L11.1427 6.0025V14.7421Z" fill="#F2F2F2"></path>
<path d="M22.2857 25.4405L11.1427 36V30.0935L16.772 24.5712L22.2857 25.4405Z" fill="black" fill-opacity="0.15"></path>
</svg>`,
tel: `
<svg viewBox="0 0 512 512" fill="currentColor" width="20px">
const through = require('through2');
const { join, resolve, dirname, sep } = require('path');
const { readFileSync } = require('fs');
const merge = require('merge-deep');
const plumber = require('gulp-plumber');
const { chalks } = require('@frontendmonster/dev-utils');
const ts = require('gulp-typescript');
const gulp = require('gulp');
const filter = require('gulp-filter');
const changed = require('gulp-changed');
@ASafaeirad
ASafaeirad / style.css
Last active December 10, 2020 09:36
JSONView Style
body {
white-space: pre;
font-family: "Input Mono";
background-color: #404859;
color: #FFF;
font-size: 13px;
}
.property {
color: #B099E3;
@ASafaeirad
ASafaeirad / mern.code-snippets
Created March 13, 2022 14:28
My VSCode snippets for MERN stack.
{
// Typescript
"constructor": {
"prefix": "ctor",
"scope": "javascript, typescript",
"body": ["constructor($1) {", " $0", "}"]
},
"Class": {
"prefix": "!c",
"scope": "javascript, typescript",
@ASafaeirad
ASafaeirad / addTuple.morph.MD
Last active May 15, 2022 17:04
Orval Tuple Morph

A morph to add tuples to orval schema.