Skip to content

Instantly share code, notes, and snippets.

View ai-matulis's full-sized avatar

Aigars Matulis ai-matulis

View GitHub Profile
@adduc
adduc / install.sh
Last active August 24, 2021 09:23
My installation of mercurial, tortoisehg, and hg-git on Ubuntu 20.04 and newer
#!/bin/bash
TARGET_DIR=/opt/repos/third-parties
HG_GIT_VERSION=${1:-default}
HG_RELEASE_VERSION=${2:-5.5.2}
HG_REPO_VERSION=${3:-stable}
TORTOISEHG_VERSION=${4:-stable}
update() {
# Update packages
@prashantsani
prashantsani / VanillaJS_ScrollTo
Last active March 12, 2024 10:37
Native Alternate(Vanilla JS) to jQuery's ScrollTo Plugins
const supportsNativeSmoothScroll = 'scrollBehavior' in document.documentElement.style;
function scrollToView(elem) {
if(supportsNativeSmoothScroll){
// https://caniuse.com/#feat=mdn-api_window_scrollto
// As of publish date of this gist,
// this is only supported in 52% browsers,
// So, the next section (`else{`) is a fallback
window.scrollTo({
behavior: 'smooth',
@dochoffiday
dochoffiday / PercentRounder.cs
Last active October 23, 2019 07:24
Uses the "Largest Remainder Method" to ensure rounded percentages add up to their correct total
using System;
using System.Collections.Generic;
using System.Linq;
public class PercentRounder
{
public class PercentInfo
{
public int Index;
public int Percent;