Skip to content

Instantly share code, notes, and snippets.

@mikimaine
mikimaine / shape-of-type.ts
Created June 1, 2023 17:26
A TypeScript type that will dynamically knows every nested object property. specially helpful when being used on a dynamic size object you want to access.
type ShapeOf<T extends Record<string, any>> = keyof {
[K in keyof T as T[K] extends string ? K: T[K] extends Record<string, unknown> ? `${K & string}.${ShapeOf<T[K]> & string}` : never]: any
}
const locales = {
en: {
welcome: 'welcome',
job: {
title: 'Job title',
@mikimaine
mikimaine / tmux.md
Created September 11, 2017 08:23 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

<?php
namespace App\Http\Requests;
use Illuminate\Validation\Rule;
use App\Http\Requests\Request;
/**
* Class TestRequest.
*/
@mikimaine
mikimaine / RequestServiceProvider.php
Last active July 18, 2017 13:44
Request service provider for Lumen
<?php
namespace App\Providers;
use App\Http\Requests\Request;
use Laravel\Lumen\Http\Redirector;
use Illuminate\Support\ServiceProvider;
use Symfony\Component\HttpFoundation\Request;
use Illuminate\Contracts\Validation\ValidatesWhenResolved;
@mikimaine
mikimaine / Request.php
Last active March 2, 2022 07:38
Request class for Lumen
<?php
namespace App\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse;
use Laravel\Lumen\Http\Redirector;
use Illuminate\Container\Container;
use Illuminate\Contracts\Validation\Validator;
@mikimaine
mikimaine / observable Pattern.js
Created April 24, 2017 08:45
sample observable pattern from RxJs talk
/**
*
* @param transformFn
* @returns {{subscribe: *, subscribe: *, map: map, map: map, filter: filter, filter: filter, delay: delay, delay: delay, reduce: reduce, reduce: reduce}}
*/
function map(transformFn){
const inputObservable = this;
const outputObservable = createObservable(function subscribe(outputObserver) {
inputObservable.subscribe({
next: function (x) {
@mikimaine
mikimaine / darkYouTube
Created April 14, 2017 20:03
Dark YouTube theme + Chnage content location and more features for YouTube....
Execute this on YouTube.com JS console. Then refresh the page and click on your Profile Pic.
You will see new options
var cookieDate = new Date();
cookieDate.setFullYear(cookieDate.getFullYear( ) + 1);
document.cookie="VISITOR_INFO1_LIVE=fPQ4jCL6EiE; expires=" + cookieDate.toGMTString( ) + "; path=/";
@mikimaine
mikimaine / joomla_take_over.py
Created January 28, 2017 13:04
Joomla! <= 3.6.4 Admin TakeOver , source 'cx' .
#!/usr/bin/python3
# Joomla! <= 3.6.4 Admin TakeOver
#Make sure you have python3 on your machine
#To run the script: chnage the target url variable
#Then open terminal
#in bash run : python3 joomla_take_over.py
#thats it
import bs4
import requests