Skip to content

Instantly share code, notes, and snippets.

@wearehyphen
wearehyphen / slick.revealPartialSlide.js
Last active August 8, 2019 20:39
Allowing partial reveal of X pixels of the next slide in a Slick-slideshow through the 'setPosition' event.
function revealPartialSlide(padding) { // Padding (amount of the next slide you want to reveal)
var $slides = $('.element').find('.slick-slide') // Find the slides
,slideCount = $slides.length // Grab the amount of slides
,slidesToShow = $('.element').slick('getOption','slidesToShow') // Grab the 'slidesToShow' number
,slideWidth = $slides.outerWidth() // Get the width of the slides (as calculated by Slick)
,newWidth = Math.round(slideWidth - (padding / slidesToShow)) // Calculate the new width
// If less slides than you want to show, do nothing....
if(slideCount < slidesToShow) {
return false;
@jesperordrup
jesperordrup / FormMailChimpController.cs
Last active August 29, 2015 14:15
Umbraco MailChimp Angularjs Ajax Form Post to WebAPI. Clean App_Code and 100% control of everything.
using MailChimp;
using MailChimp.Helper;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.ServiceModel.Channels;
@{
var tagsFromService = UmbracoContext.Application.Services.TagService.GetAllContentTags("ArticulateTags");
}
<ul class="list-unstyled">
@foreach(var newTag in tagsFromService)
{
<li><a href="/burn-after-reading/tags/@newTag.Text">@newTag.Text</a> (@newTag.NodeCount)</li>
}
</ul>
@alindgren
alindgren / XMLSitemap.cshtml
Last active October 7, 2024 07:50
XML sitemap for Umbraco 7 (based on Cultiv Search Engine Sitemap package). See http://www.alexlindgren.com/archive/dynamically-generated-xml-sitemaps-with-umbraco-7/
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System.Linq;
@{
Layout = null;
Response.ContentType = "text/xml";
}<?xml version='1.0' encoding='UTF-8' ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
@ListChildNodes(Umbraco.TypedContent(UmbracoContext.Current.PageId).AncestorOrSelf(1))
@EdCharbeneau
EdCharbeneau / AsJson.cshtml
Last active November 8, 2021 17:37
Turn any Umbraco content into a JSON object by using a Razor template
@*Experimental, I'm still fairly new to Umbraco there could be an API avialbe for this already.
This was inspired by http://cultiv.nl/blog/razor-vs-base-to-output-json-in-umbraco/
If there is a better way please let me know via twitter @EdCharbeneau
Add this template to your Umbraco site and any content can be called via Ajax using
/mySite/contentPath/?alttemplate=AsJson
Return value will be { propertyAlias : value }
Ex: { "personAlias" : "John Doe", "id" : 1002 }
*@
@bitinn
bitinn / README.md
Last active September 21, 2023 20:36
A soft-fullscreen prompt for iOS7+

A soft-fullscreen prompt for iOS7+

Background

iOS 7.0 and iOS 8 (Beta) do not have support for minimal-ui viewport keyword, nor do they response to window.slideTo(0,1) or support Fullscreen API, which means there is no easy way to tell Mobile Safari to hide address bar/menu without user interaction.

This is a problem for Web App that mimics Native App design, where html/body are commonly set to height: 100%, so browser viewport = available screen estate. There are currently no solution besides adding apple-mobile-web-app-capable meta and ask users to manually Save to Homescreen.

Frustrated by this limit, we present a soft-fullscreen prompt design, which, coupled with proper CSS hack, can achieve soft-fullscreen with relatively small effort from users.

@gregrickaby
gregrickaby / infinite-scroll-masonry-imagesloaded.php
Last active June 14, 2023 13:01
Infinite Scroll + Masonry + ImagesLoaded
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@hijonathan
hijonathan / form.html
Last active August 1, 2023 19:14
Submit a HubSpot form with AJAX without redirecting the user.
<form class='form-inline' id='my-custom-form'>
<div class="form-group">
<input type='email' class='form-control' placeholder='Your email address' required>
</div>
<button class="btn btn-primary" type='submit'>Sign up</button>
</form>
<!-- Actual form that gets submitted to HubSpot -->
<div class="hidden" id='hubspot-form'>
<script charset="utf-8" src="//js.hsforms.net/forms/current.js"></script>
@sbosell
sbosell / home.cshtml
Created February 18, 2014 01:20
Umbraco Angular Home Template
@inherits Umbraco.Web.Mvc.UmbracoViewPage<App.Models.AngRenderModel>
@{
Layout = Model.isApp ? "Blank.cshtml" : "Static.cshtml";
}
@section Content {
@if (Model.isApp)
{
<article umb-children="content.Id" cycle="{slides: '>div'}" style="clear: both">
<div ng-repeat="slider in children">
@sbosell
sbosell / web.config
Created February 18, 2014 01:10
Umbraco Angular Rewrite Rules
<rewriter>
<!-- ignore all umbraco routes -->
<rewrite url="^(/umbraco/.*)" to="$1" processing="stop" />
<!-- ignore all images, css, html fragments -->
<rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.html|\.less|\.htm)(\?.+)?)$" to="$1" processing="stop" />
<!-- if the header contains app we know it is a call to get a template. We need to let it pass -->
<if header="app" match="true">
<rewrite url="(.*)" to="$1" processing="stop"/>
</if>
<!-- if google is indexing let's let it proceed and get all non angular views which is just the normal umbraco views with razor -->