Skip to content

Instantly share code, notes, and snippets.

@skipjac
skipjac / article.hbs
Created February 12, 2018 20:39
video library in Zendesk Guide
<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 April 20, 2016 20:28
For order data
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,':')

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 December 24, 2015 06:50
Find promoted articles in a single category using zendesk curly bars
{{#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 July 20, 2015 00:41
Validate email in zendesk Help Center ticket forms.
$('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 June 26, 2015 18:04
hide submit request for anonymous users
var userRole = HelpCenter.user.role;
if (userRole === "anonymous") {
$(".banners").hide();
}
@skipjac
skipjac / setOrg.js
Last active August 29, 2015 14:21
Set the default org zendesk
$(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 August 29, 2015 14:20
build to functions to run in a loop with the options you want to show and hide
//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
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 April 3, 2015 15:46
Remove Ticket Form option from dropdown in Zendesk
//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');
});
});