Skip to content

Instantly share code, notes, and snippets.

View saeedseyfi's full-sized avatar
:bowtie:

Saeed Seyfi Dorcheh saeedseyfi

:bowtie:
  • Spotify
  • Stockholm, SE
View GitHub Profile
@saeedseyfi
saeedseyfi / challange.md
Last active May 24, 2022 22:48
Closest Available Value - JS Object Proxy Challenge

Find Closest Available Parent - JavaScript Object Proxy Challenge

Problem

We have an object, containing nested locations and their coordinates:

const data = {
  name: 'World',
  coords: '0,0',
  sweden: {
    name: 'Sweden',
@saeedseyfi
saeedseyfi / App.tsx
Last active May 7, 2022 09:26
React TypeScript Declarative Switch Cases
import React, { useEffect, useState } from "react";
import { Switch, Case } from "./Switch";
import "./styles.css";
export default function App() {
const [count, setCount] = useState(1);
useEffect(() => {
const inverval = setInterval(() => {
@saeedseyfi
saeedseyfi / git.sh
Last active June 21, 2018 08:05
My Git Setup
# aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.lg 'log --oneline'
git config --global alias.last 'log -1 HEAD'
# git-completion
npm i -g git-completion
@saeedseyfi
saeedseyfi / reinstall_git_brew.md
Last active June 20, 2018 10:15 — forked from brandonsimpson/reinstall_git_brew.md
Re-installing Git on Mac OSX with Brew

Re-installing Git on Mac OSX with Brew

This is helpful if you've previously installed git from source on OSX, and other compilers can't find the correct path. You need to remove the current version of git, then re-install with brew.

Uninstall git if installed manually

  1. Check which git you're running:
which git
@saeedseyfi
saeedseyfi / direction.scss
Created September 2, 2016 12:23
How to support rtl and ltr in sass. (I'd suggest using this method: https://gist.github.com/saeedseyfi/4eb9f4634d5eb053da05375c59092da8)
.my-element {
padding: 50px;
background: yellow;
[dir=rtl] & {
float: right;
}
[dir=ltr] & {
float: left;
@saeedseyfi
saeedseyfi / direction.scss
Created September 2, 2016 11:43
RTL/LTR support using sass mixins.
$layout-direction: ltr !default;
@mixin ltr {
@if $layout-direction == ltr {
@content;
}
}
@mixin rtl {
@if $layout-direction == rtl {
@content;
@saeedseyfi
saeedseyfi / ratio.css
Last active June 8, 2016 11:30
A sass mixin + its output with 1x1 and 16x9 sample ratios. This will keep image aspect ratio with pure css, independent from width & height.
/* ratio.scss output: */
.ratio-1-1 {
display: block;
position: relative;
height: 0;
overflow: hidden;
padding-bottom: 100%;
}
.ratio-1-1 img {