Skip to content

Instantly share code, notes, and snippets.

View JimiSweden's full-sized avatar

Jimi Friis JimiSweden

  • Live For Real
  • Stockholm Sweden
View GitHub Profile
@asmagin
asmagin / GenerateSitecoreNugetPackages.ps1
Last active November 25, 2019 18:42
Powershell script to generate nuget packages with dependencies
param(
[string] $Major = "8",
[string] $Minor = "1",
[string] $Update = "0",
[string] $Date = "151003",
[string] $nugetPath = ".\tools\nuget.exe",
[string] $downloadsPath = ".\downloads",
[string] $nuspecTemplate = ".\tools\package.nuspec.xml",
[string] $apiKey,
[string] $nugetFeed = "http://use-your.own/nuget/Sitecore-Libs"
@WilbertOnGithub
WilbertOnGithub / QueueBackgroundWorkItem example
Created May 13, 2015 09:16
QueueBackgroundWorkItem example
public class ValuesController1 : ApiController
{
// POST api/<controller>
public void Post([FromBody]string value)
{
HostingEnvironment.QueueBackgroundWorkItem(ct => StartBackgroundTask());
}
private async Task StartBackgroundTask()
{
@vkhorikov
vkhorikov / CustomerController.cs
Last active July 30, 2024 14:25
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
@hofmannsven
hofmannsven / README.md
Last active February 7, 2025 13:12
Git CLI Cheatsheet
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active December 18, 2024 15:41
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: