Skip to content

Instantly share code, notes, and snippets.

View Talento90's full-sized avatar

Marco Talento Talento90

View GitHub Profile
#Add Groovy Script Permissions: Manage Jenkins » In-process Script Approval and Approve
def job = jenkins.model.Jenkins.instance.getItemByFullName('folder//projname')
def myBuild = job.getBuild('123')
myBuild.keepLog(true)
export default function() {
//window.server = this;
this.get('users', { timing: 4000 });
this.get('itineraries', { timing: 2000 });
};
@Talento90
Talento90 / test.js
Created October 10, 2017 16:15 — forked from StephaneTrebel/test.js
Unit testing in nodejs with proxyquire and sinon
// Awesomeness first
const _ = require('lodash');
const proxyquire = require('proxyquire');
const sinon = require('sinon');
// Mocha + Chai are used here but feel free to use your test framework of choice !
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
@Talento90
Talento90 / .travis.yml
Created February 13, 2018 16:43 — forked from ryboe/.travis.yml
Example .travis.yml for Golang
language: go
# Only the last two Go releases are supported by the Go team with security
# updates. Any versions older than that should be considered deprecated.
# Don't bother testing with them. tip builds your code with the latest
# development version of Go. This can warn you that your code will break
# in the next version of Go. Don't worry! Later we declare that test runs
# are allowed to fail on Go tip.
go:
- 1.9
@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])) {
@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 / 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 / dotnetlayout.md
Created December 25, 2018 23:23 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/

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 / 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: