Skip to content

Instantly share code, notes, and snippets.

View apanzerj's full-sized avatar

Adam Panzer apanzerj

View GitHub Profile
@apanzerj
apanzerj / former.html
Created June 8, 2012 23:10
Former Version 2 GIST
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
</head>
<div id="box_form">
<form id="zFormer" method="POST" action="former.php" name="former">
<p>
<label for="z_name">Your Name:</label>
<input type="text" value="Adam Panzer" name="z_name">
@apanzerj
apanzerj / former.php
Created June 11, 2012 16:10
Former PHP GIST 1
<?php
define("ZDAPIKEY", "YOURAPIKEY");
define("ZDUSER", "YOURUSERNAME");
define("ZDURL", "https://SUBDOMAIN.zendesk.com/api/v2");
function curlWrap($url, $json)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
@apanzerj
apanzerj / former.php
Created June 11, 2012 18:08
Former PHP GIST 2
<?php
foreach($_POST as $key => $value){
if(preg_match('/^z_/i',$key)){
$arr[strip_tags($key)] = strip_tags($value);
}
}
$create = json_encode(array('ticket' => array('subject' => $arr['z_subject'], 'comment' => array( "value"=> $arr['z_description']), 'requester' => array('name' => $arr['z_name'], 'email' => $arr['z_requester']))));
$return = curlWrap("/tickets.json", $create);
?>
@apanzerj
apanzerj / former_V1.html
Created June 12, 2012 18:52
Former Version 1 GIST
<html>
<div id="box_form">
<form id="zFormer" method="POST" action="former.php" name="former">
<p>
Your Name:<input type="text" value="Adam Panzer" name="z_name">
</p>
<p>
Your Email Address: <input type="text" value="apanzer@zendesk.com" name="z_requester">
</p>
<p>
@apanzerj
apanzerj / snippet1.js
Created June 12, 2012 19:07
jQuery Snippet of a Dialog for Former
$('#box_form').dialog({
autoOpen: false,
height: 375,
width: 350,
modal: true,
buttons: [
{
text: "Cancel",
click: function() {
$(this).dialog("close");
@apanzerj
apanzerj / curlWrap.php
Created June 12, 2012 23:58
curlWrap function.
<?php
define("ZDAPIKEY", "");
define("ZDUSER", "");
define("ZDURL", "https://subdomain.zendesk.com/api/v2");
/* Note: do not put a trailing slash at the end of v2 */
function curlWrap($url, $json, $action)
{
$ch = curl_init();
@apanzerj
apanzerj / MaxIncidents.php
Created June 13, 2012 08:34
MaxIncidents PHP Code
<?php
//Get Incident Data
$id = $_GET[id];
$data = curlWrap("/tickets/".$id.".json", null, "GET");
//Find problem ticket and count incidents
$source = $data->ticket->problem_id;
$num = curlWrap("/tickets/".$source."/incidents.json", null, "GET");
$num = count($num->tickets);
@apanzerj
apanzerj / gist:2924143
Created June 13, 2012 13:42
Row Coloration Based on Custom Field
$j(document).ready(function(){
$j('.linked > td.<custom field id>').each(function(){
if($j(this).text() == "high"){
$j(this).parent().css('background-color', '#E89090');
$j(this).html('<img src="https://github.com/apanzerj/images/raw/master/flag_mark_red.png" width="10" height="10">');
}
if($j(this).text() == "medium"){
$j(this).parent().css('background-color', '#E8E890');
$j(this).html('<img src="https://github.com/apanzerj/images/raw/master/flag_mark_yellow.png" width="10" height="10">');
}
@apanzerj
apanzerj / gist:3281849
Created August 7, 2012 05:10
Widget Stack JS
$j(document).ready(function() {
$j('#tray').css('display', 'none').css('position', 'relative');
$j('#showMe').click(function() {
$j('#tray').slideToggle();
$j('#show').toggle();
$j('#hide').toggle();
}).css('cursor', 'pointer');
});​
@apanzerj
apanzerj / gist:3281967
Created August 7, 2012 05:31
Widget Stack CSS
​#tray{
display: none;
position: relative;
}
.idThief_base{
}
.idThief_primary{
font-color: black;
}
.border_style{