Skip to content

Instantly share code, notes, and snippets.

View Vladis466's full-sized avatar
🥰

Vlad Predovic Vladis466

🥰
View GitHub Profile
@Vladis466
Vladis466 / delete-stale-local-branches.bash
Created April 6, 2022 13:52
Here’s a script that deletes branches that used to exist on the remote but no longer do
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
@Vladis466
Vladis466 / minHeap_maxHeap.txt
Created November 30, 2021 21:53 — forked from WuchiOnline/minHeap_maxHeap.txt
MinHeap and MaxHeap implementation for C#
public class MinHeap
{
private readonly int[] _elements;
private int _size;
public int Count {get => _size;}
public MinHeap(int size)
{
_elements = new int[size];
}
@Vladis466
Vladis466 / Spinner.tsx
Created September 2, 2020 13:57
Tailwindcss typescript spinner
import React from "react";
const Spinner = (props: { size?: string, color?: string }) => {
const { size = 'md', color = 'black' } = props;
const width: {[key:string]: string}= {
sm: "w-6",
md: "w-8",
lg: "w-10",
};
@Vladis466
Vladis466 / BitFlyerBlockTransactionFeeOptimizationProblem
Created April 28, 2018 00:16
Capacity of 1000000 gives a max value of approx 14.2593 BTC.
using System;
using System.IO;
namespace MiningOptimizationTesting
{
/// <summary>
/// Test implementation of an algorithm to maximize potential returns for mining a block
/// Based on the knapsack 0-1 DP solution.
/// </summary>
public class BlockTransactionOptimizer
@Vladis466
Vladis466 / gist:002db1243661509a5090eb15aa56b6e3
Created April 9, 2018 03:44
Xamarin.Forms Tabbed Items bar /w on click color change events
<StackLayout Orientation="Horizontal" Margin="0" Padding="0" VerticalOptions="Start">
<StackLayout Margin="0,0,0,0" Padding="0" VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand">
<Button Clicked="ButtonPosts_Clicked" Command="{Binding ListAllPostsCommand}" Image="fa_burger.png" HeightRequest="20" VerticalOptions="StartAndExpand" Margin="15" HorizontalOptions="CenterAndExpand"/>
</StackLayout>
<StackLayout Margin="0,0,0,0" Padding="0" VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand">
<Button Clicked="ButtonPosts_Clicked" Command="{Binding ListVideosCommand}" Image="fa_videos.png" HeightRequest="20" HorizontalOptions="CenterAndExpand" Margin="15" VerticalOptions="StartAndExpand"/>
</StackLayout>
<StackLayout Margin="0,0,0,0" Padding="0" VerticalOptions="StartAndExpand" HorizontalOptions="CenterAndExpand">
using Android.Content;
using Android.Graphics;
using Android.Graphics.Drawables;
using Selectron.Field.RouteTracker.Droid.Renderers;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(Picker), typeof(CustomPickerRenderer_Droid))]
namespace Selectron.Field.RouteTracker.Droid.Renderers
{
@Vladis466
Vladis466 / Xamarin Forms Xaml BackDrop Shadow
Created January 5, 2018 22:04
Creating a shadow Backdrop using xaml in xamarin forms without having to resort to native implementation
<Frame HorizontalOptions="FillAndExpand" Padding="1,1,1,1" Margin="5,5,5,5" HasShadow="True">
<Frame.BackgroundColor>
<Color x:FactoryMethod="FromRgba">
<x:Arguments>
<x:Int32>0</x:Int32>
<x:Int32>0</x:Int32>
<x:Int32>0</x:Int32>
<x:Int32>128</x:Int32>
</x:Arguments>
</Color>