Skip to content

Instantly share code, notes, and snippets.

View izniburak's full-sized avatar
🏠
Working from home

İzni Burak Demirtaş izniburak

🏠
Working from home
View GitHub Profile

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@izniburak
izniburak / perf-diagnostics.css
Created January 14, 2021 18:09 — forked from tkadlec/perf-diagnostics.css
CSS used to highlight potential performance issues
:root {
--violation-color: red; /* used for clear issues */
--warning-color: orange; /* used for potential issues we should look into */
}
/* IMAGES */
/*
* Lazy-Loaded Images Check
* ====
@izniburak
izniburak / Container.php
Created November 23, 2020 07:39
Simple Dependency Injection (DI) Container for PHP
<?php
class Container
{
/**
* @var array
*/
protected $instances = [];
/**
import { useState, useLayoutEffect } from 'react'
const useLocalStorage = (key, defaultValue = null, prefix = 'store') => {
const storeKey = `${prefix}-${key}`
const [value, setValue] = useState(() => {
const data = localStorage.getItem(storeKey)
return data === null ? defaultValue : JSON.parse(data)
})
class App extends Component {
constructor(props) {
super(props);
this.state = {
foo: "",
bar: "",
};
}
// Reusable for all inputs
onChange = e => {
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
module.exports = (string) => {
return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();
};
@izniburak
izniburak / Laravel-Container.md
Last active November 23, 2020 07:46
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@izniburak
izniburak / habersistemim-kitap.rb
Created November 21, 2017 07:47
habersistemim kitap hediye çekilişi için yazdığım ufak script
require 'rubyXL'
require 'terminal-table'
person = 2
extra = true
file_ruby = RubyXL::Parser.parse 'liste-ruby.xlsx'
file_go = RubyXL::Parser.parse 'liste-go.xlsx'
list_ruby = file_ruby.first.to_a.shuffle
list_go = file_go.first.to_a.shuffle