Skip to content

Instantly share code, notes, and snippets.

View Talento90's full-sized avatar

Marco Talento Talento90

View GitHub Profile
@Talento90
Talento90 / Documentation.cs
Created January 3, 2020 12:00 — forked from hlaueriksson/Examples.cs
PuppeteerSharp Documentation
using System;
using System.Threading.Tasks;
using Xunit;
namespace PuppeteerSharp.Extensions.Tests
{
public class Documentation
{
[Fact]
public async Task download_Chromium()
@Talento90
Talento90 / thumbnail-generator.js
Created August 7, 2019 16:49
Generate Thumbnail from video using Node.js
"use strict";
const
ffmpegPath = require("@ffmpeg-installer/ffmpeg").path,
ffprobePath = require("@ffprobe-installer/ffprobe").path,
ffmpeg = require("fluent-ffmpeg");
ffmpeg.setFfprobePath(ffprobePath);
ffmpeg.setFfmpegPath(ffmpegPath);
using System;
namespace StackExchange.Redis
{
static class RedisKeyspaceNotifications
{
/// <summary>
/// NOTE: For this sample to work, you need to go to the Azure Portal and configure keyspace notifications with "Kxge$" to
/// 1) turn on expiration notifications (x),
/// 2) general command notices (g) and
# Commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
# Optional cleanup:
git branch -D mybranchname_unsquashed
@Talento90
Talento90 / squash-commits.md
Created June 21, 2019 11:00 — forked from longtimeago/squash-commits.md
How to squash commits in a GitHub pull request

How to squash commits in a GitHub pull request

o you've contributed some code to an open source project, say, Rails. And they'd like you to squash all of the commits in your pull request. But you're not a git wizard; how do you make this happen?

Normally, you'd do something like this. I'm assuming upstream is a git remote that is pointing at the official project repository, and that your changes are in your 'omgpull' branch:

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@Talento90
Talento90 / dotnetlayout.md
Created December 25, 2018 23:23 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@Talento90
Talento90 / TracingClientInterceptor.js
Created December 6, 2018 16:24 — forked from drobertduke/TracingClientInterceptor.js
A NodeJS implementation of a gRPC client logging interceptor
'use strict';
const bunyan = require('bunyan');
const grpc = require('grpc');
const log = bunyan.createLogger({name: 'TracingClientInterceptor'});
module.exports = function(options, nextCall) {
return new grpc.InterceptingCall(nextCall(options), {
start: function(metadata, listener, next) {
@Talento90
Talento90 / clean_code.md
Created November 14, 2018 10:06 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@Talento90
Talento90 / difference.js
Created July 13, 2018 09:50 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {