This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include("vendor/autoload.php"); | |
| $subdomain = "subdomain"; | |
| $username = "[email protected]"; | |
| $password = "password"; | |
| $headers = array('Content-Type' => 'application/json'); | |
| $options = array('auth' => array($username, $password)); | |
| $newTicket = array ( | |
| 'ticket' => array ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('span.nesty-input').detach(); | |
| var formOptions = $("#request_issue_type_select option"); | |
| var nullOption = $("<option value>-</option>"); | |
| var externalOptions = _.chain(formOptions) | |
| .filter(function(option) { | |
| return option.value == 33297; | |
| }) | |
| .value(); | |
| var internalOptions = _.chain(formOptions) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import thread | |
| import threading | |
| import requests | |
| s = requests.Session() | |
| s.headers.update({'Content-Type': 'application/json'}) | |
| s.auth = ('USERNAME/token','TOKEN') | |
| #r = s.post("http://requestb.in/1hjs6jw1", data=payload) | |
| ticketCount = 4000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $username = '__USERNAME__'; | |
| $password = '__PASSWORD__'; | |
| $url = 'https://__SUBDOMAIN__.zendesk.com/api/v2/tickets.json'; | |
| //$data = http_build_query($data); //use if sending data, ticket object or whatnot | |
| $context_opts = [ | |
| 'http' => [ | |
| 'method' => 'GET', | |
| 'header' => "Content-Type: application/json\r\n" . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| var Client = require('client.js'); | |
| return { | |
| requests: { | |
| requestOne: function() { | |
| return { | |
| url: '/api/v2/tickets.json' | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var req_link = $('.submit-a-request'); // class selector for submit request link, now we can req_link.hide() and req_link.show() | |
| var sub_tag = 'tix_sub_approved'; // sub_tag variable essentially holds the 'approved tag' value, whatever you decide | |
| var hc_user = HelpCenter.user; // Just a shortcut to type less later | |
| var user_path = window.location.pathname; // user's current path (everything after the tld, HC home pathname is "/hc/en-us/") | |
| var is_approved = false; | |
| if (hc_user.hasOwnProperty('tags')) { // anonymous user objects don't have a 'tags' property, first check if it exists...no? then no link | |
| if(hc_user.tags.indexOf(sub_tag) > -1) { | |
| req_link.show(); // if tags[] exists and one of them matches approved tag, show link | |
| is_approved = true; // since this is the only case where we approve a user, lets make a shortcut for future checking... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var currentPath = window.location.pathname; | |
| if (currentPath.indexOf('/hc/en-us') > -1) { | |
| $.get('/api/v2/users.json?role[]=admin&role[]=agent') | |
| .done(function(data){ | |
| var select = []; | |
| console.log(data); | |
| _.each(data.users, function(user){ | |
| select.push("<option value=\"" + user.id + "\">" + user.name + "</option>"); | |
| }); | |
| console.log(select); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Servo Control | |
| import time | |
| def set(property, value): | |
| try: | |
| f = open("/sys/class/rpi-pwm/pwm0/" + property, 'w') | |
| f.write(value) | |
| f.close() | |
| except: | |
| print("Error writing to: " + property + " value: " + value) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import httplib | |
| import base64 | |
| import string | |
| connection = httplib.HTTPSConnection('SUBDOMAIN.zendesk.com', 443, timeout = 30) | |
| auth = base64.encodestring('%s:%s' % ("EMAIL/token", "APITOKEN")).replace('\n', '') | |
| headers = {"Authorization":"Basic " + auth} | |
| connection.request('GET', '/api/v2/users/me.json', None, headers) | |
| try: | |
| response = connection.getresponse() | |
| content = response.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from requests.auth import HTTPBasicAuth | |
| import json | |
| auth = HTTPBasicAuth('EMAIL_ADDR/token', 'TOKEN') | |
| headers = {'content-type': 'application/json'} | |
| s = requests.Session() |