Skip to content

Instantly share code, notes, and snippets.

View visoft's full-sized avatar

Damien White visoft

View GitHub Profile
The following code throws an exception: "Error HRESULT E_FAIL has been returned from a call to a COM component."
<telerik:RadWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
mc:Ignorable="d"
x:Class="Sample.UserControl1"
@visoft
visoft / application.html.haml
Created July 7, 2011 23:02
Custom Breadcrumb Builder that handles a render action from the controller using breadcrumbs_on_rails. Instead of highlighting the "middle" item as active, e.g. Home >> **Widgets** >> New, the last item will be highlighted instead (so New in the previous
// Usage
= render_breadcrumbs :builder => BreadcrumbBuilder
@visoft
visoft / StringExtensions.cs
Created March 24, 2013 23:05
String extensions to make pluralization, etc. easier. Inspiration for these came from Ruby on Rails.
using System;
using System.Data.Entity.Design.PluralizationServices;
using System.Globalization;
namespace VisoftInc.Common.Extensions
{
public static class StringExtensions
{
public static string ToTitleCase(this string value)
{
@visoft
visoft / close_button.css
Created March 24, 2013 23:07
Simple CSS close button
.close_button {
-moz-box-shadow:inset 0px 1px 0px -23px #f29c93;
-webkit-box-shadow:inset 0px 1px 0px -23px #f29c93;
box-shadow:inset 0px 1px 0px -23px #f29c93;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #fe1a00), color-stop(1, #ce0100) );
background:-moz-linear-gradient( center top, #fe1a00 5%, #ce0100 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fe1a00', endColorstr='#ce0100');
background-color:#fe1a00;
-moz-border-radius:5px;
-webkit-border-radius:5px;
public static DateTime EasterSunday(int year)
{
int day = 0;
int month = 0;
int g = year % 19;
int c = year / 100;
int h = (c - (int)(c / 4) - (int)((8 * c + 13) / 25) + 19 * g + 15) % 30;
int i = h - (int)(h / 28) * (1 - (int)(h / 28) * (int)(29 / (h + 1)) * (int)((21 - g) / 11));
@visoft
visoft / Ember-Delete-Button-Component.markdown
Created June 19, 2014 22:18
Ember Delete Button Component

Ember Delete Button Component

Using Zurb Foundation and Font Awesome, I came up with a delete button that changes to a confirmation button. If you confirm, the delete goes through, otherwise if you move your mouse off the button, it resets back to just a normal delete button.

A Pen by Damien White on CodePen.

License.

@visoft
visoft / plugin.coffee
Created October 10, 2014 12:35
Simple jQuery Plugin with CoffeeScript
$ = jQuery
$.myPlugin = (element) ->
plugin = this
plugin.init = ->
# Do stuff here
# initialize the plugin
plugin.init()
@visoft
visoft / currency_helpers.coffee
Created December 19, 2014 13:54
Formatting numbers with commas using an Ember helper
Ember.Handlebars.helper 'formatCurrency', (value) ->
value = value || 0
Number(value).toFixed(0).replace /(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,"
@visoft
visoft / application.controller.js
Last active February 23, 2016 01:50
Complex Computed Property Test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Complex Computed Property Test'
});
@visoft
visoft / application.hbs
Last active September 25, 2018 19:02
Ember Sample Counter
{{counter-component}}
{{outlet}}