Skip to content

Instantly share code, notes, and snippets.

View jeremypage's full-sized avatar

Jeremy Page jeremypage

  • Trafford Council
  • UK
View GitHub Profile
@impressivewebs
impressivewebs / gist:f7f079b276f56c5bd900
Created December 23, 2014 08:31
HTML Inspector Bookmarklet
javascript:void((function(d){h=d.createElement('script');h.src='//cdnjs.cloudflare.com/ajax/libs/html-inspector/0.8.1/html-inspector.js';d.body.appendChild(h);})(document));
...
@using (Html.BeginContensisForm("MyAction", "api/MyApiController"))
{
@Html.ValidationSummary("Validation Summary", new { @class = "validation-summary-class" })
<div class="form-group">
<label for="firstname">Firstname:</label>
@Html.TextBox("Firstname", null, new { @type = "email", @class = "form-control" })
</div>
...
}
@using Contensis.Framework.Web
@{
AppContext.Current.Page.Scripts.Add("/siteelements/scripts/jqueryvalidate/jquery.validate.js");
AppContext.Current.Page.Scripts.Add("/siteelements/scripts/jqueryvalidate/jquery.validate.unobtrusive.js");
// define some validation rules against fields within the Form
Validation.Add("Username",
Validator.Required("You must provide a username"),
Validator.StringLength(10, 0, "No more than 10 letters")
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Web.Http;
using Contensis.Framework.Web.Controllers;
namespace Zengenti
{
[RoutePrefix("api/MyApiController")]
public class MyController : ContensisApiController
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Web.Http;
using Contensis.Framework.Web.Controllers;
namespace Zengenti
{
[RoutePrefix("api/MyApiController")]
@ps-team
ps-team / Local view menu
Last active December 15, 2022 08:28
Recreating the Contensis Local View Menu in Razor
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
<ul class="sys_menu">
@{
// Loading jQuery through the Contensis API
AppContext.Current.Page.Scripts.RegisterJQuery();
if(CurrentNode != null) {
@jeremypage
jeremypage / git-cheatsheet.md
Last active May 5, 2025 06:31
Git cheatsheet

Git cheatsheet

Find all instances of text in all commits

git grep "text to look for" $(git rev-list --all)

List commit messages since given commit

@jeremypage
jeremypage / jQuery-noConflicy.md
Last active December 28, 2020 07:37
jQuery: Using noConflict() to use multiple versions of jQuery on the same page

How to use multiple versions of jQuery on the same page

First, reference 'legacy' jQuery version:

<script src="jquery.1.10.2.js"></script>

Do any necessary legacy jQuery stuff, and anything that is not version-dependent:

@chriskempson
chriskempson / vs-code-strip-attributes-from-html-tags.txt
Last active October 25, 2023 00:27
VS Code - Strip Attributes from HTML Tags
# Couldn't figure out how to do /s or get VS Code to search over newlines so came up with this convoluted mess '[\S\s]*?\n?' that matches all characters plus newlines
Search for: <(table|tr|td|p|div|span)[\S\s]*?\n?>
Replace with: <$1>
@mhagrelius
mhagrelius / steps.md
Created October 4, 2019 13:04
Steps to encrypt web.config

For Single Box

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef connectionStrings "C:\Folder\Project"

To Share Across Environments

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pc "SiteRSAEncryptionKeys" -exp C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pa "SiteRSAEncryptionKeys" "COMPUTER\UserName"

Setup ConfigProtectedData section of web.config

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef connectionStrings "C:\Folder\Project" -prov "SiteRSAEncryptionProvider"