Skip to content

Instantly share code, notes, and snippets.

@jarrodbell
jarrodbell / main.js
Last active December 29, 2015 05:59
JavaScript example for using CommandFusion iViewer to process data returned from a HTTP Request to a Z-Wave MiCasaVerde Vera Lite system
var myJSON, baseURL = "http://192.168.1.90:3480/data_request?id=lu_status2&DataVersion=1&DeviceNum=";
function requestData(deviceNum) {
CF.request(baseURL + deviceNum, function(status, headers, body) {
if (status == 200) {
// OK response received, now grab the JSON string from body and turn it into an object
myJSON = JSON.parse(body);
// Now assign one of the known state variables to a serial join (if it will always be at a certain index in the state array)
@jramsahai
jramsahai / dynamically_resize_player_using_css.html
Last active January 14, 2019 16:20
If you're looking for a way to dynamically resize the Vidyard inline JavaScript player, you'll find an example of one way to do it below.
<!--
Refer to this article for more information:
http://knowledge.vidyard.com/Core_Features/Publish_your_players/011_Publish_your_player/014_Dynamically_resize_the_inline_player
-->
<html>
<head>
<style type="text/css">
.innerContainer {
position: relative;
display: block;
@cou929
cou929 / detect-private-browsing.js
Last active May 1, 2024 21:07
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@nul800sebastiaan
nul800sebastiaan / gist:8641249
Last active December 24, 2018 09:53
What's this Umbraco route hijacking all about? (more info in this blog post: http://cultiv.nl/blog/whats-this-umbraco-route-hijacking-all-about/)
// MODEL
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Models;
namespace Cultiv.Models
{
public class BlogOverview : RenderModel
@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 -->
@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">
@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>
@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>
@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.

@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 }
*@