Skip to content

Instantly share code, notes, and snippets.

View alirezas's full-sized avatar
🐢

Alireza Sarabchi alirezas

🐢
View GitHub Profile
interface ZodString {
type: "string",
parse(val: unknown): string
}
interface ZodNumber {
type: "number",
parse(val: unknown): number
}
interface ZodUnknown {
type: "unknown",
{
"meta": {
"theme": "flat"
},
"basics": {
"name": "Alireza Sarabchi",
"label": "Front-end Developer",
"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4",
"summary": "I am a multidisciplinary designer and front-end developer with over 15 years of experience. During my career, I've worked in various fields of web development, including back-end development, UI/UX, research, management, and business development. These experiences have given me the insight to build, develop, and implement software with companies' needs and business requirements in mind. Additionally, I have experience in managing and mentoring teams and individuals.",
"website": "https://alireza.ws",
プラグイン名 バージョン URL
Add Selected Colours To Document Palette 1.3.0 https://github.com/johnmcclumpha/sketch-add-colors-to-palette
Add Selected colors... 0.11.4
Batch Create Symbols 1.1 https://github.com/demersdesigns/sketch-batch-symbols
Craft 1.0.60 http://labs.invisionapp.com/craft
Design System Manager 1.1.25
Find and Replace 2.8.3 https://github.com/thierryc/Sketch-Find-And-Replace/
Font Finder 1.2 https://github.com/ukn530/FontFinder
Image average color 1.1 https://github.com/AntonioJMartinez/sketch-imageAverageColor
# backup all postgres databases in a gz file
pg_dumpall -U postgres -p 5432 --quote-all-identifiers | gzip >postgresapp.sql.gz
# restore backup file
gunzip <postgresapp.sql.gz | psql
@alirezas
alirezas / rename.py
Created August 7, 2017 08:57
Rename filenames in a directory to lowercase in python.
import os
path = os.chdir('DIRECTORY_PATH')
files = os.listdir(path)
for file in files:
os.rename(file, file.lower())
@alirezas
alirezas / fade.js
Created February 13, 2017 10:54
fadeIn & fadeOut in vanilla js
function fadeOut(el){
el.style.opacity = 1;
(function fade() {
if ((el.style.opacity -= .1) < 0) {
el.style.display = "none";
} else {
requestAnimationFrame(fade);
}
})();
@alirezas
alirezas / toPersianDigit.js
Created February 13, 2017 10:53
Convert latin digit to persian in vanilla js
String.prototype.toPersianDigit = function (latinDigit) {
return this.replace(/\d+/g, function (digit) {
var enDigitArr = [], peDigitArr = [], i, j;
for (i = 0; i < digit.length; i += 1) {
enDigitArr.push(digit.charCodeAt(i));
}
for (j = 0; j < enDigitArr.length; j += 1) {
peDigitArr.push(String.fromCharCode(enDigitArr[j] + ((!!latinDigit && latinDigit === true) ? 1584 : 1728)));
}
return peDigitArr.join('');
@alirezas
alirezas / getTimeRemaining.js
Created February 13, 2017 10:49
Calculate remaining time with vanilla js
var deadline = '2017-03-15';
function getTimeRemaining(endtime){
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor( (t/1000) % 60 );
var minutes = Math.floor( (t/1000/60) % 60 );
var hours = Math.floor( (t/(1000*60*60)) % 24 );
var days = Math.floor( t/(1000*60*60*24) );
return {
'total': t,
@alirezas
alirezas / slack_rtl_support.user.js
Last active March 25, 2022 10:31
RTL support for slack.com
// ==UserScript==
// @name RTL Slack
// @namespace slask.com
// @include https://*.slack.com/*
// @version 1.2.2
// @grant none
// ==/UserScript==
function isRTL(text) {
if (text !== "") {
//Based on the original source of Nick Stamas @nickstamas https://github.com/nickstamas/Sketch-Quick-Pic
//Modified by @timur_carpeev
//Latest modification by @_alirezas
if ([selection count] > 0) {
var request = [[NSMutableURLRequest alloc] init];
[request setHTTPMethod:@"GET"];
var queryString = "http://uifaces.com/api/v1/random";
[request setURL:[NSURL URLWithString:queryString]];