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 / modal.html
Created May 12, 2017 19:50
shows how to access the parent client easily from a modal iframe.
<html>
<head>
<meta charset="utf-8">
<!-- http://garden.zendesk.com -->
<link rel="stylesheet" href="https://assets.zendesk.com/apps/sdk-assets/css/0/zendesk_garden.css" type="text/css">
</head>
<body>
<h2 class="u-gamma">Hello, World!</h2>
<!-- https://github.com/zendesk/zendesk_app_framework_sdk -->
<script type="text/javascript" src="https://assets.zendesk.com/apps/sdk/2.0/zaf_sdk.js"></script>
@dpawluk
dpawluk / upload_attachment.py
Last active April 17, 2017 17:34
Upload an attachment to a Help Center article
import requests
SUBDOMAIN = 'subdomain'
s = requests.Session()
s.auth = ('email@domain/token','VERYSECRETTOKEN')
def upload_attachment(article_id, path):
filename = "test.png"
import requests
import json
from itertools import zip_longest
import pandas as pd
import numpy as np
@dpawluk
dpawluk / modal.html
Created February 17, 2017 20:28
Establishing a modal instance and communicating with it from the parent instance
<html>
<head>
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous">
</script>
</head>
@dpawluk
dpawluk / parsefile.html
Created January 31, 2017 21:43
Read a JSON file and parse it or paste the text to a display area. ZAFv2
<html>
<head>
<meta charset="utf-8">
<!-- http://garden.zendesk.com -->
<link rel="stylesheet" href="https://assets.zendesk.com/apps/sdk-assets/css/0/zendesk_garden.css" type="text/css">
<style>
#display_box {
width:200px;
height: 100px;
}
@dpawluk
dpawluk / make_requests.html
Created January 20, 2017 21:39
V2 making a request and logging response
<html>
<head>
</head>
<body>
<h2>Test</h2>
<div id="main_view">
</div>
@dpawluk
dpawluk / main.js
Created January 20, 2017 16:30
redaction_v2 snippet showing dynamic view event handling
<html>
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.css" type="text/css" rel="stylesheet"/>
<link href="./css/styles.css" type="text/css" rel="stylesheet"/>
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous">
</script>
@dpawluk
dpawluk / chat_stats_by_month.py
Last active June 18, 2020 09:25
Get chat output by month from Zopim API
import requests
import json
from itertools import zip_longest
import pandas as pd
import numpy as np
config = {
'username': 'EMAILGOESHERE',
'password': 'PASSWORDGOESHERE',
'base_path': 'https://www.zopim.com/api/v2'
@dpawluk
dpawluk / iframe.html
Created January 2, 2017 21:06
Simple function to emulate v1 template switching using external hbs templates in the assets folder. Note: cdns used to acquire some common libraries.
<html>
<body>
<!-- https://github.com/zendesk/zendesk_app_framework_sdk -->
<script
type="text/javascript"
src="https://assets.zendesk.com/apps/sdk/2.0/zaf_sdk.js" >
</script>
<script
type="text/javascript"
@dpawluk
dpawluk / ticket_get_user.js
Created December 28, 2016 19:48
Get user data using the ticket.requester while in the ticket_sidebar location
<html>
<head>
<style type="text/css">
h2 {
border: 5px solid #efefef;
border-radius: 4px;
padding: 5px;
font-size: 100%;
text-align: center;
margin-bottom: 30px;