Skip to content

Instantly share code, notes, and snippets.

@rishavpandey43
rishavpandey43 / git-commit-styleguide.md
Last active May 5, 2024 20:14
This gist consist of the rules and best practice of good conventional git commit message

Git Commit Messages Style-Guides

  • Use the present tense ("Add feature" not "Added feature")
  • Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
  • Limit the first line to 72 characters or less
  • Reference issues and pull requests liberally after the first line
  • When only changing documentation, include [ci skip] in the commit title
  • Consider starting the commit message with an applicable emoji

Types

using R3;
// Action<T1, T2> -> Observable<(T1, T2)>
public class Foo
{
event Action<int, string> OnFoo;
public Observable<(int, string)> OnFooAsObservable()
{
@ManUtopiK
ManUtopiK / clean-graphql.js
Last active May 5, 2024 20:11
Clean graphql response : Remove edges, node and __typename from graphql response
/**
* Remove edges, node and __typename from graphql response
*
* @param {Object} input - The graphql response
* @returns {Object} Clean graphql response
*/
const cleanGraphQLResponse = function(input) {
if (!input) return null
const output = {}
const isObject = obj => {
@mcrumm
mcrumm / component_under_test.ex
Last active May 5, 2024 20:07
Testing Phoenix.LiveComponent in Isolation
# lib/party_web/components/example_component.ex
defmodule PartyWeb.ExampleComponent do
@moduledoc """
An example LiveComponent under test.
"""
use Phoenix.LiveComponent
def render(assigns) do
~H"""
<div>
@SurajValluru
SurajValluru / HomeFragment.kt
Created May 5, 2024 20:06 — forked from preetham1316/HomeFragment.kt
Sticky Header with Click Listeners for Recycler View
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.stickyheader.databinding.FragmentHomeListBinding
import com.example.stickyheader.header.StickyHeaderItemDecorator
import com.example.stickyheader.model.ItemModel
@EvgenyOrekhov
EvgenyOrekhov / A simple Docker and Docker Compose install script for Ubuntu.md
Last active May 5, 2024 20:06
A simple Docker and Docker Compose install script for Ubuntu

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

function calculate_median($arr) {
$count = count($arr); //total numbers in array
$middleval = floor(($count-1)/2); // find the middle value, or the lowest middle value
if($count % 2) { // odd number, middle is the median
$median = $arr[$middleval];
} else { // even number, calculate avg of 2 medians
$low = $arr[$middleval];
$high = $arr[$middleval+1];
$median = (($low+$high)/2);
}
#!/bin/bash
# sudo apt install jq wget curl
# usage: github-install user/repo
set -e
repo=$1
tmp="/tmp/.github-install"
binpath="$HOME/.local/bin"
rm -rf $tmp
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active May 5, 2024 20:02
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@pb111
pb111 / Random Forest Classification with Python and Scikit-Learn.ipynb
Created May 26, 2019 00:48
Random Forest Classification with Python and Scikit-Learn
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.