Skip to content

Instantly share code, notes, and snippets.

View alisafariir's full-sized avatar
🎯
Focusing

Ali Safari alisafariir

🎯
Focusing
View GitHub Profile
@alisafariir
alisafariir / local-storage.service.ts
Created March 4, 2024 17:15
Angular LocalStorage Service With Encryption
import { Injectable } from '@angular/core';
import * as CryptoJS from 'crypto-js';
const SECRET_KEY = 'ooG7ImX5GKl6MQBX7GQU1Swi';
@Injectable({
providedIn: 'root',
})
export class StorageService {
set(key: string, value: unknown) {
const encrypted = CryptoJS.AES.encrypt(
@alisafariir
alisafariir / gsettings.bash
Last active April 26, 2023 19:59
Switch input language by shift and alt in ubuntu
$ gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Shift>Alt_L','<Shift>Alt_R']"
$ gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "['<Alt>Shift_L','<Alt>Shift_R']"
@alisafariir
alisafariir / launch.json
Created December 27, 2022 21:17
Nestjs vs code debugging
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Program",
"request": "launch",
"type": "node",
@alisafariir
alisafariir / react-router-layout.jsx
Last active December 16, 2018 17:48
react js routing in fixed layout. thanks to @madcoda
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Link, Match, Redirect, Switch } from 'react-router-dom'
import OverviewPage from './page/OverviewPage'
import AccountPage from './page/AccountPage'
/*
Layouts, inline define here for demo purpose
you may want to define in another file instead
*/
@alisafariir
alisafariir / mixins.scss
Last active August 27, 2018 11:11
Sass Useful Mixins
// Gradient Mixin
@mixin gradient($start, $end) {
background-color: $start;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#{$start}, endColorstr=#{$end});
background-image: -moz-linear-gradient(center top, $start, $end);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($start), to($end));
}
// Border Raius Mixin
@mixin border-radius($radius) {