Skip to content

Instantly share code, notes, and snippets.

View BjornFridal's full-sized avatar

Bjørn Fridal BjornFridal

View GitHub Profile
@BjornFridal
BjornFridal / _sizing.scss
Created February 18, 2022 10:54
Bootstrap v4. Responsive Sizing eg. w-md-50 w-lg-75
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
@each $prop, $abbrev in (width: w, height: h) {
@each $size, $length in $sizes {
.#{$abbrev}#{$infix}-#{$size} { #{$prop}: $length !important; }
}
}
}
@BjornFridal
BjornFridal / C# Create shared Event ID for Facebook Pixel and Facecbook Conversion API
Last active August 11, 2021 11:44
Use it in a controller with the Conversion API and in a view with the Facebook Pixel. Since the HttpContext is the same the generated eventId will also be the same in the frontend and backend.
@{
var eventId = System.Web.HttpContext.Current.Timestamp.Ticks + "." + HttpContext.Current.Session.SessionID;
}
@BjornFridal
BjornFridal / app_offline.htm
Last active November 4, 2020 17:46 — forked from deshion/app_offline.htm
Basic maintenance page for IIS
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>Down for maintenance</title>
<style type="text/css">
body { background:#fbfbfb; font-family:arial;}
h1, p { text-align:center; }
@BjornFridal
BjornFridal / gist:a1fac50d99d7aff40cc8
Last active November 8, 2021 17:35
Adding css classes to paragraph tag (no spans!) in RTE/TinyMCE in Umbraco v.7+
// In \Umbraco\Js\umbraco.controllers.js find this code (line 5429-5432 in version 7.1.3):
else if (rule.selector[0] == "#") {
r.inline = "span";
r.attributes = { id: rule.selector.substring(1) };
}
// directly after, add this:
else if (rule.selector.indexOf("p.") == 0) {
r.classes = rule.selector.substring(2);
r.block = 'p';
@BjornFridal
BjornFridal / gist:e59b98b20f6d680c4151
Last active August 29, 2015 14:01
Disable Umbraco v.7.1.3-5 RTE/TinyMCE auto image resizing
//
// IMPORTANT, as of ver. 7.2.4 there's a max size in the RTE which you can set to zeo. That will disable the auto resize, so you don't need the code below
//
// In \Umbraco\Js\umbraco.services.js uncomment this (line 5218-5233 in version 7.1.3):
protected string MD5CheckSum(IDictionary<string, string> inputFields, string md5secret)
{
string[] keys = { "protocol", "msgtype", "merchant", "language", "ordernumber", "amount", "currency", "continueurl", "cancelurl", "callbackurl" };
string values = "";
foreach (string key in keys)
if (inputFields.Any(s => s.Key == key))
values += inputFields[key];
return GetMd5Hash(values + md5secret);
}
using (SqlConnection cn = new SqlConnection("***connection string***")) {
cn.Open();
SqlCommand cmd = new SqlCommand("SELECT id, contentNodeId, dataInt, dataNtext FROM cmsPropertyData WHERE (propertytypeid = ***id***) AND (dataNtext IS NOT NULL) ORDER BY contentNodeId", cn);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read()) {
int dataInt;
int nodeId;
if (int.TryParse(dr["id"].ToString(), out nodeId) && int.TryParse(dr["dataNtext"].ToString(), out dataInt)) {