- 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
Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using R3; | |
// Action<T1, T2> -> Observable<(T1, T2)> | |
public class Foo | |
{ | |
event Action<int, string> OnFoo; | |
public Observable<(int, string)> OnFooAsObservable() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
- Use
curl
to get the JSON response for the latest release - Use
grep
to find the line containing file URL - Use
cut
andtr
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 \" \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder