Skip to content

Instantly share code, notes, and snippets.

import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@matijagrcic
matijagrcic / HeaderLogo.tsx
Created May 22, 2019 07:46 — forked from ryanditjia/HeaderLogo.tsx
Gatsby + TypeScript
// Example useStaticQuery
// this is src/components/HeaderLogo.tsx
import { graphql, Link, useStaticQuery } from 'gatsby'
import React from 'react'
import { HeaderLogoQuery } from '../types/__generated__/HeaderLogoQuery'
const query = graphql`
query HeaderLogoQuery {
contentfulCompanyMetadata {
@matijagrcic
matijagrcic / NVMe_AHCI
Last active May 1, 2019 20:25
I've needed to change to ACHI so that the NVMe driver can be installed, it wouldn't otherwise and the Samsung Magician wouldn't recognize the drive. https://twitter.com/matijagrcic/status/1067498617366294528
If you don’t see Command Prompt listed, it’s because you have already been updated to a later version of Windows.
If so, use this method instead to get to the Command Prompt:
Click the Start Button and type cmd
Right-click the result and select Run as administrator
Type this command and press ENTER: bcdedit /set {current} safeboot minimal
If this command does not work for you, try bcdedit /set safeboot minimal
Restart the computer and enter BIOS Setup (the key to press varies between systems).
Change the SATA Operation mode to AHCI from either IDE or RAID (again, the language varies).
Save changes and exit Setup and Windows will automatically boot to Safe Mode.
Right-click the Windows Start Menu once more. Choose Command Prompt (Admin).
@matijagrcic
matijagrcic / NVMe_AHCI
Created May 1, 2019 20:25
I've needed to change to ACHI so that the NVMe driver can be installed, it wouldn't otherwise and the Samsung Magician wouldn't recognize the drive.
If you don’t see Command Prompt listed, it’s because you have already been updated to a later version of Windows.
If so, use this method instead to get to the Command Prompt:
Click the Start Button and type cmd
Right-click the result and select Run as administrator
Type this command and press ENTER: bcdedit /set {current} safeboot minimal
If this command does not work for you, try bcdedit /set safeboot minimal
Restart the computer and enter BIOS Setup (the key to press varies between systems).
Change the SATA Operation mode to AHCI from either IDE or RAID (again, the language varies).
Save changes and exit Setup and Windows will automatically boot to Safe Mode.
Right-click the Windows Start Menu once more. Choose Command Prompt (Admin).
Microsoft Windows [Version 10.0.17134.345]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd %systemroot%\system32
C:\Windows\system32>copy mstsc.exe mstsc2.exe
1 file(s) copied.
C:\Windows\system32>cd %systemroot%\system32\en-us\
@matijagrcic
matijagrcic / VSCode_AspNETCore.txt
Last active January 13, 2019 23:03
dotnet new - Creates a new project, configuration file, or solution based on the specified template.
> dotnet dev-certs https --trust
> https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new?tabs=netcore21
> dotnet run
Templates Short Name Language Tags
----------------------------------------------------------------------------------------------------------------------------
Console Application console [C#], F#, VB Common/Console
Class library classlib [C#], F#, VB Common/Library
Unit Test Project mstest [C#], F#, VB Test/MSTest
NUnit 3 Test Project nunit [C#], F#, VB Test/NUnit
@matijagrcic
matijagrcic / download_chrome41.js
Created October 29, 2018 16:58 — forked from ebidel/download_chrome41.js
For when you need to test your site in Google Search (Chrome 41).
/**
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#upgrade
pip install --upgrade youtube-dl
youtube-dl -v -x --audio-format mp3 --audio-quality 320k https://www.youtube.com/watch?v=xKjyXiuvuHE
#can use -x as it's a shortcut for --extract-audio
youtube-dl --extract-audio --audio-format mp3 #url_to_playlist
#from txt file
youtube-dl -v -x --audio-format mp3 --audio-quality 320k --batch-file sets.txt
CVIJA - BRZINA (OFFICIAL VIDEO)
Kao Kokain - Elitni Odredi (OFFICIAL HD VIDEO)
G-Unit - Stunt 101
Ona nam daje
Jalopnik Vs. Kotaku in Mario Kart 8
Preetha Subbarayalu: Inside Reliable Collections
Mory Kante Yeke Yeke
The Black Eyed Peas - Shut Up
Eminem - Without Me
Cypress Hill - Tequila Sunrise

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array: T[] 🔒 ES3