Skip to content

Instantly share code, notes, and snippets.

@skipjac
skipjac / article.hbs
Created Feb 12, 2018
video library in Zendesk Guide
View article.hbs
<div class="article-main" data-section-id="{{section.id}}" data-section-name="{{section.name}}">
<div id="sidebar" class="sidebar-panel">
<ul class="sidebar">
<div class="close-sidebar">←</div>
<li class="sidebar-item sidebar-home">
<a href="{{page_path 'help_center'}}" class="sidebar-item-title">
Home
</a>
</li>
<li :class="['sidebar-item', 'sidebar-section', isOpen(category.id)]"
@skipjac
skipjac / bs-parser.js
Last active Apr 20, 2016
For order data
View bs-parser.js
var data = 'Orders[Count=1, Order [customer=Customer [id=6a665314-44ac-4fd9-af73-ed975fb19018, name=Tarik, givenname=Taaza, birthday=Wed Apr 20 05:12:19 CEST 2016, plz=50933, street=Aachener Str., house=746-750, city=Köln], name=Installation, note=not ready, created=Wed Apr 20 05:12:19 CEST 2016, status=not ready]]'
function ordersJSONize(str) {
return str
//right bracket replacement
.replace(/]/g,'}')
//left bracket replacement
.replace(/\[/g,'{')
// equal sign replacement
.replace(/\b=|!(\s=)/g,':')
View keybase.md

Keybase proof

I hereby claim:

  • I am skipjac on github.
  • I am skip (https://keybase.io/skip) on keybase.
  • I have a public key ASCX8kPbL_oHxuVUuWG0bqfjYKdx7YWystJ54VqnJdPHOwo

To claim this, I am signing this object:

@skipjac
skipjac / find_promoted_artilces.hdbs
Created Dec 24, 2015
Find promoted articles in a single category using zendesk curly bars
View find_promoted_artilces.hdbs
{{#each categories}}
{{! CMS promoted articles }}
{{#is id 202178748}}
<h2>{{name}}</h2>
{{#each sections}}
{{#each articles}}
{{#if promoted}}
<li>
<a href="{{url}}">{{title}}</a>
</li>
@skipjac
skipjac / email_validate.js
Created Jul 20, 2015
Validate email in zendesk Help Center ticket forms.
View email_validate.js
$('input').keyup(function(e){
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if(e.target.name === 'request[anonymous_requester_email]'){
var match = re.test(e.target.value);
console.log(match);
};
});
@skipjac
skipjac / hideSubmitRequest
Created Jun 26, 2015
hide submit request for anonymous users
View hideSubmitRequest
var userRole = HelpCenter.user.role;
if (userRole === "anonymous") {
$(".banners").hide();
}
@skipjac
skipjac / setOrg.js
Last active Aug 29, 2015
Set the default org zendesk
View setOrg.js
$(document).ready(function(){
function setDefaultValue(field, setDefault){
$('.'+field).one('DOMNodeInserted', function(d){
var inputTar = $(d.currentTarget).children('select')
var inputNest = $(d.currentTarget).children('a.nesty-input');
var TestObj = inputTar[0];
var TestNest = inputNest[0];
$('#'+TestObj.id).append('<option value="-">-</option>');
$('#'+TestObj.id+' option').removeAttr('selected').filter('[value='+setDefault+']').attr('selected', true);
$(TestNest).text(setDefault);
@skipjac
skipjac / amy.js
Last active Aug 29, 2015
build to functions to run in a loop with the options you want to show and hide
View amy.js
//make a function to hide options as they are passed into it.
var skip1 = function(k){
$('.nesty-panel').on('DOMNodeInserted', function(e){
$(this).children('ul').children(k).hide();
});
}
// call the function with the option value with a # in front
skip1('#sss_a_1')
//make a function to show the option
View gist:7369800af18234cd8761
HC.api('user',function(x){console.log(x);})
Object { identifier: "da39a3ee5e6b4b0d3255bfef95601890afd80709",
role: "anonymous",
avatar_url: "https://assets.zendesk.com/images/frame_user.png",
email: null,
name: null,
orgainizations: []
}
@skipjac
skipjac / gist:8783de387d23bf171645
Created Apr 3, 2015
Remove Ticket Form option from dropdown in Zendesk
View gist:8783de387d23bf171645
//remove the options from the select
$('#request_issue_type_select option[value="43517"]').remove();
//remove the option from the nesty-input after it's been created.
$('div').one('DOMNodeInserted', function(e){
$('.nesty-panel').one('DOMNodeInserted', function(e){
$(this).children('ul').children().remove('#43517');
});
});