Skip to content

Instantly share code, notes, and snippets.

@pmunin
pmunin / EnumerablePartitionExtension.cs
Last active September 19, 2020 02:29
C# Enumerable extension for Partitioning also know as Pagination- allows to split enumerable into partitions of specified max size
using System.Linq;
public static class EnumerablePartitionExtensions{
/// <summary>
/// Generate lazy partitions for enumerable
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="items">source items to create partitions from</param>
@zulhfreelancer
zulhfreelancer / first_commit_in_branch.md
Created December 2, 2016 04:11
How to find the first commit in a Git branch?
$ git log <source_branch>..<feature_branch> --oneline | tail -1

Reference

@jmarolf
jmarolf / editorconfig.md
Last active September 26, 2023 12:55
List of all options and how they may be implemented in editorconfig

Advanced

editorconfig name possible values
dotnet_sort_system_directives_first true , false

Indentation Options

editorconfig name possible values
csharp_indent_block_contents true , false
csharp_indent_braces true , false
@aviaryan
aviaryan / zsh-on-windows.md
Last active February 9, 2024 03:22
Installing zsh and oh-my-zsh on Windows
  1. Install zsh from cygwin
  2. Install oh-my-zsh from https://github.com/robbyrussell/oh-my-zsh . Follow the manual instructions
  3. To make zsh default on ConEmu, create a task with C:\cygwin64\bin\mintty.exe /usr/bin/zsh - . Make it the defaut shell.
  4. To start a zsh shell on demand, add this batch script to your path or start menu or wherever.
start C:\cygwin64\bin\mintty.exe /usr/bin/zsh -
@haacked
haacked / download-nuget-licenses.ps1
Last active September 5, 2022 16:35
A PowerShell script to download your NuGet package licenses as first seen in http://haacked.com/archive/2015/03/28/download-nuget-package-licenses/
Split-Path -parent $dte.Solution.FileName | cd
New-Item -ItemType Directory -Force -Path ".\licenses"
@( Get-Project -All | ? { $_.ProjectName } | % { Get-Package -ProjectName $_.ProjectName } ) | Sort -Unique Id | % { $pkg = $_ ; Try { (New-Object System.Net.WebClient).DownloadFile($pkg.LicenseUrl, (Join-Path (pwd) 'licenses\') + $pkg.Id + ".html") } Catch [system.exception] { Write-Host "Could not download license for $($pkg.Id)" } }
@sporto
sporto / 1-introduction.md
Last active November 17, 2024 14:52
CanJS: Communication between components

Introduction

The intention of this document is to explore patterns of communication between can components and discuss possible improvements and newer patterns.

We should aim for:

  • Making common scenarios easier
  • Establishing best practices and canonical patterns
  • Having as little surprise as possible, it should be clear from looking at the code exactly what the intention is
  • Aligning with future standards, specifically try to align with web components as much as possible
@glombard
glombard / add-credential.bat
Created May 1, 2014 10:59
Use cmdkey to add a Git credential to the Windows Credential Manager
# to add a new Git credential to the Credential Manager:
cmdkey /generic:LegacyGeneric:target=git:https://github.com /user:username /pass:"mypassword"
# to list all credentials:
cmdkey /list
@lrobeson
lrobeson / .bash_profile
Created November 13, 2013 19:36
Git branch bash autocomplete with aliases (optional). Add to .bash_profile.
# To Setup:
# 1) Save the .git-completion.bash file found here:
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
# 2) Add the following lines to your .bash_profile, be sure to reload (for example: source ~/.bash_profile) for the changes to take effect:
# Git branch bash completion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
# Add git completion to aliases
@deanapeterson
deanapeterson / staticInclude.js
Created October 23, 2013 20:51
Include a view/template without creation of a new scope. Refined from snippet provided on this stackoverflow entry: http://stackoverflow.com/questions/12393703/how-to-include-one-partials-into-other-without-creating-a-new-scope#answer-17340138. jsFiddle: http://jsfiddle.net/DeanIconWeb/BVXUe/
module.directive('staticInclude', ["$http", "$templateCache", "$compile", "$parse",function($http, $templateCache, $compile, $parse) {
return function(scope, element, attrs) {
var templatePath = $parse(attrs.staticInclude)(scope);
attrs.$observe("staticInclude", function(value){
scope.$watch(value, function(templatePath){
loadTemplate(templatePath);
});
@stephenscaff
stephenscaff / fade-title-up-and-down-onscroll.html
Created September 13, 2013 11:51
Fade hero title down + up on scroll with a touch of jquery and CSS keyframes. No keyframe support? Loser. But, no worries, just fade title in and out with animate opacity then.
<!DOCTYPE html>
<head>
<!-- CSS
================================================== -->
<style>
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;