Skip to content

Instantly share code, notes, and snippets.

View aliemir's full-sized avatar
😶‍🌫️
Working from home

Ali Emir Şen aliemir

😶‍🌫️
Working from home
View GitHub Profile
@aliemir
aliemir / refine-development.sh
Last active April 26, 2023 13:47
A small command line tool for easier development on [`refine`](https://refine.dev)
#!/bin/zsh
# A small command line tool for easier development on [`refine`](https://refine.dev)
version="1.7.0"
name="\e[35m[refine-development]\e[0m"
all_args=("$@")
first_arg="$1"
scopes_array=()
@aliemir
aliemir / index.js
Created March 9, 2022 12:50
Javascript - Remove property from object without mutating the original one in one line
/*
* Using destructuring, we can remove a dynamic key from an object without `delete` keyword in one line.
*/
const baseObj = { a: 1, b: 2, c: 3 };
const removeKey = "b";
const { [removeKey]: _remove, ...newObj } = baseObj;
@aliemir
aliemir / validations.ts
Created March 1, 2022 12:09
simple validation functions in typescript
const emailRegexp =
/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
const alphabeticRegexp = /^[a-zA-Z\s]*$/g;
const specialsRegexp = /[`\+=\?!\]\[\$}{:\/&\\@#\|<>;]/g;
const nonNumericRegexp = /\D/g;
export const isEmail = (email?: string | number | undefined) => {
return Boolean(`${email ?? ''}`.match(emailRegexp));
};
@aliemir
aliemir / README.MD
Last active September 9, 2024 18:57
How to use `ionicons` in React + TypeScript project

How to use ionicons in React + TypeScript project

With this code snippet, you can use Ionicons in your React + TypeScript project with code completion and without any errors from React side.

  • Copy the content of the ion-icons.d.ts file.
  • Add scripts inside your <head> tags.
<head>
 
@aliemir
aliemir / keybindings.json
Created January 1, 2021 16:55
my vscode custom keybindings to switch between sidebar views and toggle focus between editor and the sidebar because activity bar sucks.
[
{
"key": "ctrl+]",
"command": "workbench.action.nextSideBarView"
},
{
"key": "ctrl+[",
"command": "workbench.action.previousSideBarView"
},
{
@aliemir
aliemir / search.jsx
Last active April 3, 2020 14:33
React Native Animated Interpolation Ornegi
const SearchView = ({navigation}) => {
const heroAnim = useRef(new Animated.Value(1)).current
const [isSearchFocus, setSearchFocus] = useState(false)
useEffect(() => {
if(isSearchFocus) {
Animated.timing(heroAnim, {
toValue: 1,
duration: 230,
useNativeDriver: false,
@aliemir
aliemir / dart.json
Created December 10, 2019 10:44
Turn every color to MaterialColor for Flutter - Snippet
{
"Custom Color Snippet": {
"prefix": "customcolor",
"body": [
"Map<int, Color> $4 = {",
"\t50:Color.fromRGBO($1, $2, $3, .1),",
"\t100:Color.fromRGBO($1, $2, $3, .2),",
"\t200:Color.fromRGBO($1, $2, $3, .3),",
"\t300:Color.fromRGBO($1, $2, $3, .4),",
"\t400:Color.fromRGBO($1, $2, $3, .5),",
@aliemir
aliemir / index.html
Created February 24, 2019 05:14
Simon Game
<div class="container">
<div class="row">
<div class="col col-md-6 offset-md-3">
<header>
<div class="head float-none text-center"><h1>Simon Game</h1></div>
<div class="settings float-left">
<a id="start-btn" class="btn btn-sm btn-info">Start</a>
<a id="strict-toggle" class="btn btn-sm btn-dark">Strict</a>
</div>
<div class="level float-right"><span class="curr-level">0</span>/20</div>