Skip to content

Instantly share code, notes, and snippets.

View rasmuschristensen's full-sized avatar
💭
Working remotely

Rasmus Tolstrup Christensen rasmuschristensen

💭
Working remotely
View GitHub Profile
cropTextImage.SaveToPhotosAlbum((imageSave, error) =>
{
//you can retrieve the saved UI Image as well if needed using
if (error != null)
{
Debug.WriteLine(error.ToString());
}
});
@rasmuschristensen
rasmuschristensen / CalculateEasterDay
Created March 22, 2016 09:47
Calculate easter day of a year. incl. leap year support
/// <summary>
/// Calculation based on https://da.wikipedia.org/wiki/P%C3%A5ske
/// </summary>
/// <param name="year"></param>
/// <returns></returns>
public DateTime GetEasterDateOfYear(int year)
{
int a = year % 19;
int b = (int)Math.Floor(year / 100m);//Heltal (rundet) ned) af aar / 100
int c = year % 100;
@rasmuschristensen
rasmuschristensen / BootboxJSCustomWidth
Created March 4, 2016 10:10
Changing the width of bootbox dialog
// css
.dialogWide > .modal-dialog {
width: 80% !important;
}
// script
bootbox.dialog({
className: "dialogWide",
title: "Foo",
message: "what to say, go wide",
buttons: {
@rasmuschristensen
rasmuschristensen / KnockoutJS Dump
Created January 26, 2016 13:20
Debug KnockoutJS Dump binding
ko.bindingHandlers.dump = {
init: function (element, valueAccessor, allBindingsAccessor, viewmodel, bindingContext) {
var context = valueAccessor();
var allBindings = allBindingsAccessor();
var pre = document.createElement('pre');
element.appendChild(pre);
var dumpJSON = ko.computed({
read: function () {
@rasmuschristensen
rasmuschristensen / javascript startswith
Created January 26, 2016 13:02
StartsWith in javascript based on pure javascript using substring or lastIndexOf
var data = 'Just something great';
var input = 'Jus';
// this one
data.substring(0, input.length) === input;
// or this one
data.lastIndexOf(input, 0) === 0