Skip to content

Instantly share code, notes, and snippets.

View rruhlen's full-sized avatar

Ricky Ruhlen rruhlen

  • San Francisco, CA
View GitHub Profile
@rruhlen
rruhlen / statuspage.js
Created April 2, 2015 18:44
AJAX request to get status from StatusPage.IO. Uses their library/wrapper which is needed to provide CORS support for IE.
<script type="text/javascript" src="//cdn.statuspage.io/se-v2.js"></script>
<script type="text/javascript">
$(function() {
//set page code for customer
var sp = new StatusPage.page({ page: 'XXXXXXXX'});
@rruhlen
rruhlen / liquid_detect_language
Created September 18, 2013 18:44
Liquid to detect language.
{% case system.language%}
{%when 'de'%}
German translation
{%when 'es_es'%}
Spanish translation
{%when 'fr_ca'%}
French Canadian translation
{%when 'fr_fr'%}
French translation
{%when 'it'%}
@rruhlen
rruhlen / statuspage.js
Created October 21, 2016 22:53
Retrieve status from statuspage.io and display message on support center. Need to create HTML tags for each message. Requirements are the Page ID and the JS file from StatusPage.
<script type="text/javascript" src="<js file>"></script>
<script type="text/javascript">
$(function() {
var sp = new StatusPage.page({ page: '<page id>'});
@rruhlen
rruhlen / BatchDeleteArticles.cls
Created May 17, 2018 23:45
Batch delete articles and topics via dev console.
public with sharing class BatchDeleteArticles implements Database.batchable<SObject>,Database.allowscallouts,Database.Stateful{
private String configId;
public BatchDeleteArticles (String configId) {
this.configId = configId;
}
public BatchDeleteArticles () {
}
@rruhlen
rruhlen / canonical
Created February 19, 2016 23:47
Create a canonical tag in the Desk web theme
{% case page %}
{% when "page_article" %}
<link rel="canonical" href="http://yoursite.desk.com/customer/portal/articles/{{article.id}}" />
{% when "page_topic" %}
<link rel="canonical" href="http://yoursite.desk.com/customer/portal/articles/{{topic.id}}" />
{% endcase %}

Keybase proof

I hereby claim:

  • I am rruhlen on github.
  • I am ruhlen (https://keybase.io/ruhlen) on keybase.
  • I have a public key ASDcqnIAZXmbuHyjRtGBjEGx1WmFmJTVzdL93ZWBnhrC_Qo

To claim this, I am signing this object:

@rruhlen
rruhlen / article.css
Created February 21, 2019 17:53
hide extra fields in article of community, need to adjust the 4 in the 2nd line.
.selfServiceArticleLayout .forcePageBlockSectionRow.full { display: none;}
.selfServiceArticleLayout .forcePageBlockSectionRow.full:nth-of-type(4) { display: block;}
.selfServiceArticleLayout.zoom .article-summary { display: none;}
.slds-form_stacked .slds-form-element .slds-form-element__label {display: none;}
@rruhlen
rruhlen / file_attachment.js
Created March 16, 2015 15:37
Multiple file attachment with deleting attached file functionality.
//Attachments Max number vs Copy New
$(function() {
attachFileUploadFields_new();
if ($("#max_number_attachments").length > 0 && $("#system-snippets-add_attachment").length > 0 && $(".desk_file_upload_new").length > 0) {
var max_attachments = parseInt($("#max_number_attachments").text());
var button_text = $("#system-snippets-add_attachment").html();
$("ul#Attachments").append("<li class='addmore'><a href='javascript::void(0)' id='add_attachment_new' class='add_attachment_new' style='display:none;'>" + button_text + "</a></li>");
var content = $(".desk_file_upload_new").html(), index = 2;
// ADD ON NEW CLICK
$("#add_attachment_new").click(function() {
@rruhlen
rruhlen / detect_page
Last active January 29, 2019 22:21
liquid example to detect page in template.
{% case page %}
{% when 'page_index' %}
{% when 'page_search_result' %}
{% when 'page_topic' %}
{% when 'page_article' %}
{% when 'question_new' or 'question_pre_create' %}
@rruhlen
rruhlen / article-lang
Created January 24, 2019 07:37
detect language and display link if page loaded is the article page
{% case system.language %}
{% when 'en_au' %}
{% if page == 'page_article' %}
AU tag
{% endif %}
{% when 'en_nz' %}
{% if page == 'page_article' %}
NZ tag
{% endif %}
{% endcase %}