Skip to content

Instantly share code, notes, and snippets.

View sliekens's full-sized avatar

Steven sliekens

View GitHub Profile
# Check the working directory for modified files
# Exit with an error if there are any
$modified = git ls-files --modified
if ($modified -ne $null) {
Write-Error "Working directory contains modified files: $modified"
exit 1
}
@sliekens
sliekens / rollup-plugin-vue-unofficial.ts
Created December 30, 2018 19:31
rollup-plugin-vue-unofficial
import { Plugin, PluginContext } from 'rollup';
import { createFilter } from 'rollup-pluginutils';
import {
parse,
compileTemplate,
TemplateCompileResult
} from '@vue/component-compiler-utils';
import { VueTemplateCompiler } from '@vue/component-compiler-utils/dist/types';
import {
ObjectExpression,
private static (BigInteger, BigInteger) RecoverPrimeFactors(BigInteger n, BigInteger e, BigInteger d)
{
// Inspired by https://www.di-mgt.com.au/rsa_factorize_n.html
var k = BigInteger.Subtract(BigInteger.Multiply(d, e), BigInteger.One);
var primes = new List<int>
{
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
@sliekens
sliekens / compare-files.ps1
Last active July 12, 2018 08:39
Comparing git-ls-files to actual filenames
Compare-Object `
-ReferenceObject (git ls-files | Resolve-Path -Relative | Sort-Object) `
-DifferenceObject (Get-ChildItem -Recurse -File | Resolve-Path -Relative | Sort-Object) `
-CaseSensitive `
-SyncWindow 0
@sliekens
sliekens / eolconfig.ps1
Last active October 7, 2021 11:58
Configure Git line normalization the right way (using PowerShell)
# first install Git 2.16+
# https://git-scm.com/download/win
git --version
# (optional) reset machine settings because per-machine config makes no sense in team projects
# the default (when not set) for core.autocrlf is false (no eol conversions)
git config --unset core.autocrlf
git config --unset core.safecrlf
git config --unset core.eol
@sliekens
sliekens / ES6ModulesHttpModule.cs
Last active June 3, 2018 21:55
Make IIS support extension-less imports
public class ES6ModulesHttpModule : IHttpModule
{
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.BeginRequest += ContextOnBeginRequest;
}
export class Hero {
id: number;
name: string;
superpower: Power;
friends: Hero[];
}
export class Power {
name: string;
}
@sliekens
sliekens / Git_mergetool_commands
Created November 10, 2017 10:16 — forked from RohanBhanderi/Git_mergetool_commands
Git Mergetool and difftool with Beyond Compare 4
//Git Mergetool and difftool with Beyond Compare 4
//For Windows
//IF running this command in git bash then escape $ with \
git config --global diff.tool bc4
git config --global difftool.bc4.cmd "\"C:/Program Files/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false
git config --global merge.tool bc4
git config --global mergetool.bc4.cmd "\"C:/Program Files/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\""
git config --global mergetool.bc4.trustExitCode true
@sliekens
sliekens / aliases.sh
Last active November 27, 2019 10:33
Useful Git aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.last "log -1 HEAD"
git config --global alias.ff "merge --ff-only"
git config --global alias.root "rev-parse --show-toplevel"
git config --global alias.done "branch --format=\"%(if:equals=gone)%(upstream:track,nobracket)%(then)%(refname:short)%(end)\""
git config --global alias.doing "branch --format=\"%(if:notequals=)%(upstream)%(then)%(refname:short)%(end)\""
git config --global alias.todo "branch --format=\"%(if:equals=)%(upstream)%(then)%(refname:short)%(end)\""
function getSequentialFocusNavigationOrder(nodeList) {
var els = Array.prototype.slice.call(nodeList);
els = els.filter(e => e.tabIndex !== -1);
els = els.filter(e => !e.disabled);
els = els.sort(function(left, right) {
if (left.tabIndex === 0) {
if (right.tabIndex === 0) {
return 0;
}
return 1;