if you're using fish shell, you can add this in your fish config:
let g:fzf_colors = {
\ 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
## Pre-requisite: You have to know your last commit message from your deleted branch. | |
git reflog | |
# Search for message in the list | |
# a901eda HEAD@{18}: commit: <last commit message> | |
# Now you have two options, either checkout revision or HEAD | |
git checkout a901eda | |
# Or | |
git checkout HEAD@{18} |
// injects the script in the body of the document. | |
// returns a promise that gets resolves once the script has been loaded in the document | |
export const injectScript = (url, document = window.document) => { | |
const script = document.createElement('script'); | |
script.src = url; | |
script.type = 'text/javascript'; | |
script.async = true; | |
const body = document.getElementsByTagName('body')?.[0] ?? null; | |
if (body === null) { |
function doSomething() { | |
return dispatch => | |
fetch( | |
'/api/something' | |
).then( | |
response => response.json() | |
).then( | |
json => dispatch({ type: DO_SOMETHING, json }), | |
err => dispatch({ type: SOMETHING_FAILED, err }) | |
); |
interface IFunc { | |
(n: number[]): number; | |
} | |
interface IOperations { | |
add: IFunc; | |
sub: IFunc; | |
mul: IFunc; | |
div: IFunc; | |
} |
import React from 'react'; | |
import { Button } from 'antd'; | |
import styled from 'styled-components'; | |
import { storiesOf } from '@storybook/react'; | |
const stories = storiesOf('Benchmarks', module); | |
const StyledButton = styled(Button)` | |
&& { | |
display: block; |
'use strict'; | |
import React, { PureComponent, useState, useEffect } from 'react'; | |
import { AppRegistry, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; | |
import { RNCamera } from 'react-native-camera'; | |
import Permissions from 'react-native-permissions'; | |
const CameraApp = () => { | |
let [flash, setFlash] = useState('off') | |
let [zoom, setZoom] = useState(0) | |
let [autoFocus, setAutoFocus] = useState('on') |
Consider the following scenario:
λ tree . (folder) 10:34:52
.
├── delete-file1
├── delete-file2
├── delete-file3
├── keep-file1
└── keep-folder
function getGithubUserInfo(username) { | |
return new Promise(function (resolve, reject) { | |
// Do the usual XHR stuff | |
var url = "https://api.github.com/users/" + username; | |
var req = new XMLHttpRequest(); | |
req.open('GET', url); | |
req.onload = function () { |
package Foo | |
import "fmt" | |
func Fn() { | |
fmt.Printf("foo") | |
} |