Skip to content

Instantly share code, notes, and snippets.

@jonico
jonico / Jenkinsfile
Last active September 3, 2024 00:13
Jenkinsfile showing advanced Postman CLI, portman (contract test generation) and newman integration including custom reporters and reporting status back to Postman
def checkout () {
context="continuous-integration/jenkins/"
context += isPRMergeBuild()?"pr-merge/checkout":"branch/checkout"
def scmVars = checkout scm
setBuildStatus ("${context}", 'Checking out completed', 'SUCCESS')
if (isPRMergeBuild()) {
prMergeRef = "refs/pull/${getPRNumber()}/merge"
mergeCommit=sh(returnStdout: true, script: "git show-ref ${prMergeRef} | cut -f 1 -d' '")
echo "Merge commit: ${mergeCommit}"
return [prMergeRef, mergeCommit]
@nio101
nio101 / k6_dashboard.json
Created September 20, 2021 09:25
k6 generic advanced dashboard
{
"annotations": {
"list": [
{
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "#5794F2",
"limit": 100,
"name": "k6",
@chrisgfortes
chrisgfortes / util-types.js
Created February 19, 2019 14:42
Util functions from lodash in pure JS:: _.isObject, _.isString, _.isNumber, _.isFunction, _.isBoolean, _.isArray, _.isRegExp
/**
* util-types could be used to replace some methods of lodash such as:
* _.isObject
* _.isString
* _.isNumber
* _.isFunction
* _.isBoolean
* _.isArray
* _.isRegExp
*/
@akexorcist
akexorcist / index.js
Last active September 13, 2024 19:03
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@mir4ef
mir4ef / save-blob-ctrl.js
Created November 29, 2016 19:31
Save a blob file in AngularJS 1.x
function SaveFileCtrl (SaveFileService) {
var vm = this;
function downloadFile(someArgument) {
SaveFileService.downloadFile({
param: someArgument
}, function (response) {
var fileName = response.headers['content-disposition'].split("=")[1].replace(/\"/gi,'');
var fileType = response.headers['content-type'] + ';charset=utf-8';
var blob = new Blob([response.data], { type: fileType });
@gmoqa
gmoqa / RetrieveEmailCommand.php
Last active August 25, 2017 13:37
Symfony2 command to retrieve and save, emails by IMAP, save the email, attachments and analize a email content for set a specific Entity.
<?php
namespace AppBundle\Command;
use AppBundle\Entity\Evento;
use AppBundle\Entity\EventoAdjunto;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@nurtext
nurtext / .htaccess
Last active May 1, 2023 19:24
Tell apache we're on HTTPS if reverse proxy is serving the site using SSL
# Let apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
# Redirect to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IFModule>
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active April 11, 2024 08:32
es6 spread immutable cheatsheet

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
@calendee
calendee / position-bars-and-content.js
Last active August 12, 2016 14:00
Automatically Position Subheaders and Content in Ionic Framework Apps
angular.module('app', ['ionic']).directive('positionBarsAndContent', function($timeout) {
return {
restrict: 'AC',
link: function(scope, element) {
var offsetTop = 0;
$obj_merged = (object) array_merge((array) $obj1, (array) $obj2);