Skip to content

Instantly share code, notes, and snippets.

View dpawluk's full-sized avatar

Daniel Pawluk dpawluk

  • Zendesk
  • Wisconsin
View GitHub Profile
@dpawluk
dpawluk / remove_href.liquid
Created August 29, 2014 15:23
Remove href data from anchor tags
{% if header contains 'http://SUBDOMAIN.zendesk.com/hc/requests/' %}
{{header | replace: 'http://SUBDOMAIN.zendesk.com/hc/requests/,''}}
{% else %}
{{header}}
{% endif %}
@dpawluk
dpawluk / Document_head_template.html
Created August 29, 2014 17:53
Some cool stuff with js and helpcenter.
<!-- add code here that should appear in the document head -->
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
@dpawluk
dpawluk / add_orgs_via_console.js
Created August 29, 2014 21:29
add_orgs_via_console
for(i=0;i<200;i++){
var name = 'Org_' + i;
$.ajax('/api/v2/organizations.json', {
'type':'POST',
'contentType':'application/json',
'data': JSON.stringify({'organization':{'name':name}})
})
.done(function(data){console.log("added org #",i);})
.fail(function(){console.log("request failed");});
}
@dpawluk
dpawluk / hacky_janky.js
Created September 2, 2014 21:08
Hacky web-portal permission based on tag for UI submission of tickets. Users with "allowed" tag can submit through web ui
$j(document).ready(function(){
var path = window.location.pathname;
if (path == "/anonymous_requests/new") {
window.location.replace("/home");
}
if(path == "/requests/new" && currentUser.tags.indexOf("allowed") === -1) {
window.location.replace("/home");
}
});
@dpawluk
dpawluk / webrequest_zendesk.cs
Created September 2, 2014 21:37
Using WebRequest
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Examples.System.Net
{
public class WebRequestGetExample
{
public static void Main ()
@dpawluk
dpawluk / lablr.rb
Created September 15, 2014 21:25
ruby label to articles
require 'net/https'
require 'uri'
require 'json'
require 'pp'
subdomain = 'SUBDOMAIN'
username = 'EMAIL'
password = 'PASSWORD'
category = 'CATEGORY_ID'
label = {:label => {:name => "cake"}}.to_json
@dpawluk
dpawluk / recip_addy_from_csv.py
Created September 18, 2014 22:30
uploads recipient addresses from csv
import requests
import pandas as pd
s = requests.Session()
s.headers.update({'Content-Type': 'application/json'})
s.auth = ('USERNAME/token','TOKEN')
df = pd.read_csv('./support_addy.csv')
for count, row in df.iterrows():
name = row[0]
address = row[1]
@dpawluk
dpawluk / googAppEng_zdphp.php
Created September 29, 2014 16:57
Use PHP and file_get_contents to make a PUT request in a Google AppEngine Environment
<?php
$email = 'SOME_USERNAME';
$token = 'API_TOKEN';
$domain = 'ROOT_URL'; //e.g. 'https://z3ndocs.zendesk.com';
$ticket_id = 0000; // int, not string
$auth_string = $email . '/token:' . $token;
$enc_auth = base64_encode($auth_string);
@dpawluk
dpawluk / test_attach.php
Created December 6, 2014 00:15
test_attach
<?php
include("vendor/autoload.php");
use Zendesk\API\Client as ZendeskAPI;
$subdomain = "";
$username = "";
$token = ""; // replace this with your token
@dpawluk
dpawluk / composer.json
Created December 6, 2014 00:16
using a branch w/composer for testing
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/zendesk/zendesk_api_client_php"
}
],
"require": {
"zendesk/zendesk_api_client_php": "dev-ggrossman/http_send_from_memory"
}