Skip to content

Instantly share code, notes, and snippets.

View Sarapulov's full-sized avatar

Andrey Sarapulov Sarapulov

  • EMEA
View GitHub Profile
@Sarapulov
Sarapulov / gist:68ab95c177cb414ecc69
Created July 11, 2014 20:42
My test GIST record
My test GIST record
@Sarapulov
Sarapulov / gist:51ae8abdbf6023bdac55
Last active August 29, 2015 14:20
Example of Help Center field and attachment validation
// EXAMPLE OF FIELD VALIDATION
$('#request_custom_fields_23591935')
.focusout(function()
{
var nameReg = /^[A-Za-z]+$/;
var isValid = $('#request_custom_fields_23591935')
.val()
.match(nameReg);
if (isValid && isValid.length > 0)
{
/*
inspired from this sources https://jqueryui.com/autocomplete/#xml
*/
$(function() {
var mydata = [];
@Sarapulov
Sarapulov / gist:4082259e08c1fa90ef71
Created May 8, 2015 12:34
Example of ticket field and attachemnt validation
// EXAMPLE OF FIELD VALIDATION
$('#request_custom_fields_23591935')
.focusout(function()
{
var nameReg = /^[A-Za-z]+$/;
var isValid = $('#request_custom_fields_23591935')
.val()
.match(nameReg);
if (isValid && isValid.length > 0)
{
@Sarapulov
Sarapulov / gist:4d3d21708baa635b4abf
Created May 8, 2015 12:38
SUBMIT A REQUEST FOR ZERO RESULTS
/*
ONE OF THESE SHOULD WORK
*/
// SUBMIT A REQUEST FOR ZERO RESULTS
if( (window.location.pathname.match("/search")) ) {
if ( $('.search-results-list').length === 0 ) { $('.search-results-column p').replaceWith( "Please now <a href='https://" + HelpCenter.account.subdomain + ".zendesk.com/" + HelpCenter.user.locale + "/requests/new'>Submit a Request</a>" ) }
}
// SUBMIT A REQUEST FOR ZERO RESULTS
@Sarapulov
Sarapulov / gist:8d5ddfa05484b0613443
Created May 12, 2015 08:31
GIPHY app source code
with( ZendeskApps.AppScope.create() ) {
var source = (function() {
return {
defaultState: "loading",
events: {
"app.activated": function() {
this.key = this._parameter("key") || this.resources.KEY;
this.tag = this._parameter("tag") || this.resources.TAG;
this.rating = (this._parameter("rating") || this.resources.RATING).toLowerCase();
@Sarapulov
Sarapulov / Assignment Control App | app.js code
Created March 7, 2016 16:43
Assignment Control App | app.js code
(function() {
return {
current_user: null,
requests: {
fetchCurrentUser: function(){
return {
url: '/api/v2/users/' + this.currentUser().id() + '.json?include=groups,organizations',
method: 'GET',
proxy_v2: true
};
@Sarapulov
Sarapulov / gist:6e57d65c0e3e3146a771a1ad4381805c
Created April 5, 2016 16:24
incoming GET request for Google sheet
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@Sarapulov
Sarapulov / gist:416edc7eab5c4d79599c5a0d1915ba4f
Created April 5, 2016 16:26
get content and send API request to Zendesk
function ImportHCcontent(){
var sheet = SpreadsheetApp.getActiveSheet();
var source = SpreadsheetApp.getActiveSpreadsheet();
var range = sheet.getDataRange();
var start_row = 1;
for (var i = start_row; i < range.getLastRow(); i++) {
// get values
console.log('@Klaus, i am working, bro...');
var results = [];
function getTickets(url) {
jQuery.ajax({
url: url,
method: "GET",
async: false
}).done(function(data) {
jQuery.each(data.results, function(i, v) {