Recently shared snippets

Created 2 months ago by anonymous
grep -rnw '/path/to/somewhere/' -e 'pattern'
-r or -R is recursive,
-n is line number, and
-w stands for match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.
Created 2 months ago by anonymous
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import SplitSlider from './SplitSlider';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(<SplitSlider
    BottomLayerTitle={'Captain America'}
    BottomLayerText={'Colored by Ruben J DelValle'}
    BottomLayerSrc={'http://www.rededits.com/projects/images/rjd_art/capamerica_colored_rjd.jpg'}
    TopLayerTitle={'B/W Captain America'}
    TopLayerText={'Inked by Ruben J DelValle'}
    TopLayerSrc={'http://www.rededits.com/projects/images/rjd_art/capamerica_inked_rjd.jpg'}
    handleColor={'orange'}
    handleRotation={33} />, document.getElementById('root'));
registerServiceWorker();
Created 2 months ago by anonymous
import math
E=3
T=40**E
D=10**E

def nu():
	for c in range(-T,T):
		yield c/D

def fu(n):
	r=n**n
	if isinstance(r,float):return r
	else:return ""

def va():
	for n in nu():
		yield fu(n)

def vb():
	for n in nu():
		yield fu(n+1/D)

def d(n):return int(n*D)

def inv(n):
	for a,b,r in zip(va(),vb(),nu()):
		if a=="" or b=="":continue
		if (d(a)<=d(n)<=d(b))or(d(b)<=d(n)<=d(a)):yield d(r)/D

while True:
	i=float(input())
	s=""
	for r in inv(i):
		if fu(r)==i:s+="="
		s+=str(r)
		s+="\n"
	print(s)
Created 4 months ago by anonymous
LocalDateTime time = LocalDateTime.now();
				LocalDateTime nextHour = time.plus(1l, ChronoUnit.HOURS).truncatedTo(ChronoUnit.HOURS)
				                                .plusMinutes(60 * (time.getMinute() / 60));
				long minutes = Duration.between(LocalDateTime.now(), nextHour).toMinutes();
Created 4 months ago by anonymous
import org.apache.commons.lang3.StringUtils;
....

 List<String> filteredAndTrimmed = Arrays.asList("abc ", " cd", "", "gh").stream().map(StringUtils::trim).filter(StringUtils::isNotBlank)
			.collect(Collectors.toList());
		 
filteredAndTrimmed.forEach(System.out::println);

//output is 
abc
cd
gh