Skip to content

Instantly share code, notes, and snippets.

View ozluy's full-sized avatar
:octocat:
Time to React!

Yusuf ozluy

:octocat:
Time to React!
  • localhost
View GitHub Profile
@ozluy
ozluy / models.js
Last active August 20, 2019 22:52
models.js
// sayac modeli
export const sayac = {
state: {
yukleniyor: false,
deger: 0,
}, // saf hal/durum (initial state)
reducers: {
// saf fonksiyon
birEkle: state => ({ ...state, ...{ deger: state.deger + 1 } }),
yukleniyoruAyarla: (state, payload) => ({ ...state, ...{ yukleniyor: payload } }),
@ozluy
ozluy / example.js
Created September 9, 2019 14:02
Reducer JS
const myArr = [{numbers:[1, 2, 3]}, {numbers:[4, 5, 6]}, {numbers:[7, 8, 9]}];
/** Reducer array of objects to array of numbers */
const myNewArr = myArr.reduce(
(acc, curr) => [...acc, ...curr.numbers],
[] //initialState
)
console.log(myNewArr)
@ozluy
ozluy / StripeScriptLoader.js
Last active September 25, 2019 12:21
Solution for loading Stripe.js and Stripe Elements
import React, { useState, useEffect } from 'react'
const StripeScriptLoader = ({
children,
uniqueId,
script,
loader = 'Loading...',
}) => {
const [stripeLoaded, setStripeLoaded] = useState({})
useEffect(() => {

delete all local branches except master

Mac

git branch | grep -v "master" | xargs git branch -D

Windows

git branch -D @(git branch | select-string -NotMatch "master" | Foreach {$_.Line.Trim()})

@ozluy
ozluy / vs-code-extensions.list
Last active July 28, 2020 09:18
VS Code Extensions
code --install-extension abusaidm.html-snippets
code --install-extension christian-kohler.npm-intellisense
code --install-extension christian-kohler.path-intellisense
code --install-extension dbaeumer.vscode-eslint
code --install-extension dsznajder.es7-react-js-snippets
code --install-extension dzannotti.vscode-babel-coloring
code --install-extension eg2.vscode-npm-script
code --install-extension esbenp.prettier-vscode
code --install-extension formulahendry.auto-close-tag
code --install-extension jpoissonnier.vscode-styled-components
@ozluy
ozluy / turkey-city-district-neighbourhood.json
Last active April 25, 2021 23:03
Turkiye-il-ilçe-mahalle
{
"cities": [
{
"id": "5907ace2192af335e137e738",
"name": "Amasya",
"districts": [
{
"id": "5907acfd79e1f73602127f2e",
"cityId": "5907ace2192af335e137e738",
"name": "Hamamözü",
@ozluy
ozluy / .eslintrc
Last active April 10, 2022 05:16
Nextjs Eslint
//.eslintrc
{
"env": {
"browser": true,
"es6": true,
"commonjs": true
},
"plugins": ["react"],
"extends": [
@ozluy
ozluy / listToTree.js
Created March 25, 2023 21:19
People.ai
const data = [
{ id: 1, name: "San Francisco", parent: 5 },
{ id: 2, name: "Los Angeles", parent: 5 },
{ id: 3, name: "San Diego", parent: 5 },
{ id: 4, name: "Tucson", parent: 7 },
{ id: 5, name: "California", parent: 6 },
{ id: 6, name: "USA", parent: null },
{ id: 7, name: "Arizona", parent: 6 },
{ id: 8, name: "Tukey", parent: null },
{ id: 9, name: "Istanbul", parent: 8 },
@ozluy
ozluy / ReactotronConfig.js
Created April 9, 2020 20:37
Rematch Reactotron setup for React Native
import Reactotron from 'reactotron-react-native'
import { reactotronRedux } from 'reactotron-redux'
import { AsyncStorage } from 'react-native'
const tron = Reactotron.configure() // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from // controls connection & communication settings
.useReactNative() // add all built-in react native plugins
.use(reactotronRedux()) // add all built-in react native plugins
.setAsyncStorageHandler(AsyncStorage)
.connect() // let's connect!