Skip to content

Instantly share code, notes, and snippets.

View Borovensky's full-sized avatar

Artem Borovensky

  • Ukraine, Kiev
View GitHub Profile
@Borovensky
Borovensky / useWhyDidYouUpdate.ts
Created March 13, 2024 16:06
useWhyDidYouUpdate.ts
function useWhyDidYouUpdate(name: string, props: any) {
// Get a mutable ref object where we can store props ...
// ... for comparison next time this hook runs.
const previousProps = React.useRef<any>();
React.useEffect(() => {
if (previousProps.current) {
// Get all keys from previous and current props
const allKeys = Object.keys({ ...previousProps.current, ...props });
// Use this object to keep track of changed props

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

function get_browser(){
var ua = navigator.userAgent;
if (ua.search(/Chrome/) > 0) return 'Chrome';
if (ua.search(/Firefox/) > 0) return 'Firefox';
if (ua.search(/Opera/) > 0) return 'Opera';
if (ua.search(/Safari/) > 0) return 'Safari';
if (ua.search(/MSIE/) > 0) return 'Internet Explorer';
return 'Не определен';
}
// SASS
.ripple
width: 0
height: 0
border-radius: 50%
background: rgba(255, 255, 255, 0.4)
transform: scale(0)
position: absolute
opacity: 1
var menu = [
['Main', ['index.thml']],
['Aboute', ['aboute.thml']],
['Catalog', [
['phone', 'phone.html'],
['computers', 'computers.html'],
['WTF', 'WTF.html']
]
],
['Contact', ['contact.thml']]
.class {
min-height: 620px;
background-image: url();
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
-webkit-background-size: cover;
background-size: cover;
}
$.fn.iconHover = function () {
return $(this).hover(
function(){
$(this).stop().fadeTo("fast", 1)
},
function(){
$(this).stop().fadeTo("slow", 0.5)
}
);
}
/* SASS version */
/* Negative indent */
.parent
width: 100%
height: 100%
position: absolute
top: 0
left: 0
overflow: auto
.block
<?php
$tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
echo '<p>Tag: <a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </p> ';
}
}
?>
<?php
$tags = wp_get_post_tags($post->ID);
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>