Skip to content

Instantly share code, notes, and snippets.

View reyou's full-sized avatar
🎯
Focusing

reyou

🎯
Focusing
View GitHub Profile
@reyou
reyou / MockHttpClient.cs
Created August 23, 2018 18:14 — forked from GeorgDangl/MockHttpClient.cs
Mock an Asp.Net Core HttpClient with a custom HttpMessageHandler using Moq
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using Moq.Protected;
namespace Tests
{
public class MockHttpClient
@reyou
reyou / gist:a0b77761ac3bfd0c2df41fc909c4b62a
Created June 24, 2018 18:10
GET logstash-*/_mapping V2
{
"logstash-2015.05.18": {
"mappings": {
"log": {
"properties": {
"@message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
{
"logstash-2015.05.18": {
"mappings": {
"log": {
"properties": {
"@message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
var express = require("express");
var app = express();
var path = require("path");
app.get('/',function(req,res){
res.sendFile(path.join(__dirname+'/index.html'));
//__dirname : It will resolve to your project folder.
});
package TheAlgorithmDesignManual.AaaIntroduction;
public class insertion_sort_class {
public void insertion_sort(int[] s, int n) {
// counters
int i, j;
for (i = 1; i < n; i++) {
j = i;
while ((j > 0) && (s[j] < s[j - 1])) {
// https://stackoverflow.com/questions/7537791/understanding-recursion-to-generate-permutations/50382627#50382627
let str = "ABC";
permute(str, 0, str.length - 1, 0);
function permute(str, left, right, depth) {
if (left === right) {
console.log("PRINT:", str + "\n");
} else {
for (let i = left; i <= right; i++) {
// https://www.youtube.com/watch?v=5cPbNCrdotA
// we are trying to find next higher value
struct Node
{
int data;
struct Node *left;
struct Node *right;
}
// function to find In order successor in a BST
/** Algorithm: given a collection (matrix) of
pixels you must find the size of the largest shape.
Shapes were defined as pixels touching each other orthogonality. */
var input = [
[1, 1, 1, 1, 0],
[1, 1, 0, 1, 0],
[1, 1, 0, 0, 0],
[0, 0, 0, 0, 0]
];
var input2 = [
struct BstNode
{
int data;
BstNode *left;
BstNode *right;
};
int FindMin(BstNode *root)
{
if (root == NULL)