Skip to content

Instantly share code, notes, and snippets.

@ctesene
ctesene / velosimo-api.js
Created March 15, 2023 18:04
Velosimo API
var Velosimo = {
_appName: '',
_key: '',
_token: '',
init: function (name, key, token) {
this._appName = name;
this._key = key;
this._token = token;
},
getCases: async function (recordId) {
@ctesene
ctesene / velosimo-ui.js
Created March 15, 2023 18:04
velosimo ui
var VelosimoUI = {
renderTemplate: (placeholder, template, data) => {
let templateHtml = document.querySelector(`#${template}`).innerHTML;
let renderTemplate = Handlebars.compile(templateHtml);
let result = renderTemplate(data);
document.querySelector(`#${placeholder}`).innerHTML = result;
}
}
@ctesene
ctesene / AngularJs
Last active December 26, 2015 22:59
A Razor Html helper that will place your angular views in the body of your view. This is helpful for a number of reasons * Browsers cache angular partial views, so when you deploy to production, some users will not see the new content, as they have cached copies of the partial views. * Reduce page navigation delays by loading up front.
using System.IO;
using System.Text;
using System.Web;
using System.Web.Mvc;
namespace YourProject.RazorExtensions
{
public static class AngularJs
{
public static IHtmlString RenderAngularViews(this HtmlHelper helper, string relativeViewPath)
@ctesene
ctesene / CapitalizeFirstLetter.js
Created July 11, 2013 16:16
Angular directive to capitalize the first letter of an input field.
angular.module('MyApp').directive("capitalizeFirstLetter",
['$',
function ($) {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs) {
var wasCapitalized = false;
function capitalizeFirstLetter() {
@ctesene
ctesene / CustomUnityDependencyResolver.vb
Last active December 14, 2015 13:48
When using ASP.NET MVC 4 and UNITY, you might randomly encounter the error The type Unity.Mvc3.UnityDependencyResolver does not appear to implement Microsoft.Practices.ServiceLocation.IServiceLocator.
Public Class CustomUnityDependencyResolver
Implements IServiceLocator
Private ReadOnly _container As IUnityContainer
Public Sub New(ByVal container As IUnityContainer)
_container = container
End Sub
Public Function GetService(ByVal serviceType As Type) As Object Implements IServiceProvider.GetService
Return _container.Resolve(serviceType)