Skip to content

Instantly share code, notes, and snippets.

View monis0395's full-sized avatar

Monis Qadri monis0395

View GitHub Profile
@monis0395
monis0395 / algorithm.txt
Last active May 30, 2021 15:06
A readable merge sort implementation in JS
Ref: https://en.wikipedia.org/wiki/Merge_algorithm#Merging_two_lists
algorithm merge(A, B) is
inputs A, B : list
returns list
C := new empty list
while A is not empty and B is not empty do
if head(A) ≤ head(B) then
append head(A) to C
@monis0395
monis0395 / flock_gitlab_mr.php
Last active June 4, 2020 05:49
Integrate Gitlab with Flock. This allows users to: 1. Send messages to the flock channel via webhook. 2 Send json payload to any webhook url 3. Only send message when MR is merged with master branch only
<?php
function isGetParamPresent($param)
{
return isset($_GET[$param]) && !empty($_GET[$param]);
}
$rawData = trim(file_get_contents("php://input"));
$decoded_data = json_decode($rawData, true);
$FLOCK_API_URL = "https://api.flock.com/hooks/sendMessage/";
package main
import (
"bufio"
"bytes"
"compress/gzip"
"crypto/tls"
"fmt"
"io"
"io/ioutil"