Skip to content

Instantly share code, notes, and snippets.

View rruhlen's full-sized avatar

Ricky Ruhlen rruhlen

  • San Francisco, CA
View GitHub Profile

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 / 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 %}
@rruhlen
rruhlen / lang-liquid
Created January 23, 2019 23:41
insert case language liquid into hard-coded url
https://service.1cover.com.au/customer/{{system.language}}/portal/articles/2926233-volcanic-eruptions-
@rruhlen
rruhlen / case_theme_liquid
Created August 1, 2018 22:38
capture a case custom field and display it when a specific value is saved in at least one of two case custom fields
{% capture feedback %}{{ custom_feedback }}{% endcapture %}
{% if case.custom_feedback == "A comment" or case.custom_feedback == "A question" %}
<div class="agent_ticket_section">
{{ feedback }}
</div>
{% endif %}
@rruhlen
rruhlen / liquid_article_body
Last active July 26, 2018 19:04
detect article and assign meta tag in header.
{% if article.body contains 'id="unique-value-1' %}
<meta property="og:image" content="jpg"/>
{% elsif article.body contains 'id="unique-value-2' %}
<meta property="og:image" content="jpg"/>
{% endif %}
@rruhlen
rruhlen / gist:ee9954c6f26fbd10496d84e77d439994
Created July 11, 2018 05:52
Post JSON to /api/v2/customers to create a customer record in your Desk account
{
"first_name": "Ricky",
"last_name": "Ruhlen",
"emails": [{
"type": "work",
"value": "ricky@gmail.com"
},
{
"type": "home",
"value": "ricky@aol.com"
@rruhlen
rruhlen / businesshours.js
Last active July 8, 2018 01:36
Show/hide chat based off business hours
<script>
(function(a){function E(a,b,c,d){var e=c.lang();return e[a].call?e[a](c,d):e[a][b]}function F(a,b){return function(c){return K(a.call(this,c),b)}}function G(a){return function(b){var c=a.call(this,b);return c+this.lang().ordinal(c)}}function H(a,b,c){this._d=a,this._isUTC=!!b,this._a=a._a||null,this._lang=c||!1}function I(a){var b=this._data={},c=a.years||a.y||0,d=a.months||a.M||0,e=a.weeks||a.w||0,f=a.days||a.d||0,g=a.hours||a.h||0,h=a.minutes||a.m||0,i=a.seconds||a.s||0,j=a.milliseconds||a.ms||0;this._milliseconds=j+i*1e3+h*6e4+g*36e5,this._days=f+e*7,this._months=d+c*12,b.milliseconds=j%1e3,i+=J(j/1e3),b.seconds=i%60,h+=J(i/60),b.minutes=h%60,g+=J(h/60),b.hours=g%24,f+=J(g/24),f+=e*7,b.days=f%30,d+=J(f/30),b.months=d%12,c+=J(d/12),b.years=c,this._lang=!1}function J(a){return a<0?Math.ceil(a):Math.floor(a)}function K(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function L(a,b,c){var d=b._milliseconds,e=b._days,f=b._months,g;d&&a._d.setTime(+a+d*c),e&&a.date(a.date()+e*c),f&&(g=a.date(),a.date(
@rruhlen
rruhlen / ExecuteDeletion.txt
Created May 17, 2018 23:48
To run this class click on Debug→Open Execute Anonymous Window
BatchDeleteArticles b = new BatchDeleteArticles(null);
database.executebatch(b,75);
@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 () {
}