Skip to content

Instantly share code, notes, and snippets.

View niczak's full-sized avatar

Nicholas Kreidberg niczak

  • Exacta Systems
  • Minneapolis, MN
  • X @niczak
View GitHub Profile
@niczak
niczak / gist:2003485
Created March 8, 2012 21:14
PHP/SOAP and Microsoft Exchange
<?php
/*
test.php
Proof of concept testing to see if we can get
PHP/SOAP talking to EWS. Thanks to Thomas Rabaix
for his documentation on NTLM auth in SOAP and to
Erik Cederstrand for his article on SOAP/Exchange.
@niczak
niczak / gist:1934929
Created February 28, 2012 20:34
jQuery .each example.
$("#email").bind("change", function(e){
$.getJSON("http://yourwebsite.com/lookup.php?email=" + $("#email").val(),
function(data){
$.each(data, function(i,item){
if (item.field == "first_name") {
$("#first_name").val(item.value);
} else if (item.field == "last_name") {
$("#last_name").val(item.value);
}
});
@niczak
niczak / gist:1872135
Created February 20, 2012 23:02
Text Parsing To Create Links
<?php
define("bDEBUG", FALSE);
// Open file handle
$hfile = fopen("./links.txt", "r");
// Set up some variables
$iCnt = 0;
$sOut = NULL;
@niczak
niczak / gist:1831675
Created February 14, 2012 23:38
Employee Charges By Account w/ Leave Usage
select
e.last_name,
e.first_name,
e.display_employee,
e.other_string3,
ld3.short_description proj_desc,
ld1.ld1 account_id,
ld1.short_description account_name,
ld3.ld1 project,
sum(tso.pay) as salary,
@niczak
niczak / gist:1690828
Created January 27, 2012 20:44
Monthly Employee Charges [CR Vars Left In]
select e.last_name, e.first_name, e.display_employee, e.other_string3, ld3.short_description proj_desc, ld1.ld1 account_id, ld1.short_description account_name, ld3.ld1 project,
sum(tso.pay) as salary, sum(tso.calc_value2) as fringe, sum(tso.calc_value4) as fringe_icr
from time_sheet_output tso,
employee_periods ep,
employee e,
ld3,
ld1
where e.employee = ep.employee
and (' All' in ({?STD_DEPARTMENT_SQL}) or ld1.ld1 in ({?STD_DEPARTMENT_SQL}))
and (' All' in ({?DRI_EMPLOYEE_TYPE_SQL}) or e.other_string3 in ({?DRI_EMPLOYEE_TYPE_SQL}))
@niczak
niczak / gist:1636196
Created January 18, 2012 22:22
Crystal Reports - Monthtly Project Report
select e.last_name, e.first_name, e.display_employee, ld3.short_description proj_desc, ld1.ld1 account_id, ld1.short_description account_name, ld3.ld1 project,
sum(tso.pay) as salary, sum(tso.calc_value2) as fringe, sum(tso.calc_value4) as fringe_icr
from time_sheet_output tso,
employee_periods ep,
employee e,
ld3,
ld1
where e.employee = ep.employee
and (' All' in ({?STD_DEPARTMENT_SQL}) or ld1.ld1 in ({?STD_DEPARTMENT_SQL}))
and tso.ld3 = ld3.ld1
@niczak
niczak / gist:1468484
Created December 12, 2011 18:35
Smarty - Strange Behavior
{if $PF_SHOP_CART_HAS_GIFT}
<PFForm:Hidden name="iGifts" value="{$PF_SHOP_CART_HAS_GIFT}" />
<h4 class="checkout">Gift Membership(s) Information</h4>
{section name="gift_memberships" loop=$PF_SHOP_CART_HAS_GIFT}
<table class="form" cellpadding="2" border="0" width="100%">
<tr>
<td align="right" nowrap>
<label for="sFirst_Gift{$smarty.section.gift_memberships.iteration}"><span class="required">*</span>First Name:</label>
</td>
<td align="left">
@niczak
niczak / gist:1344041
Created November 7, 2011 02:09
String Split Example
<?php
/*
This is a simple example of how str_split() works.
Written: 11/06/2011, Nicholas Kreidberg
Revised: 11/06/2011, Nicholas Kreidberg
*/
$description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam molestie tristique lectus in imperdiet. In libero nisi, semper viverra molestie id, ultricies sit amet diam. Etiam in tellus sed risus viverra vulputate in vitae quam. Aenean elementum.";
@niczak
niczak / gist:1343979
Created November 7, 2011 01:42
Check field length, replace text and alert user
$(document).ready(function() {
// bind function to event
$("#description").keyup(function()
{
// store value
var description = $("#description").val();
// check length
if(description.length > 244)
{
// grab substr
@niczak
niczak / gist:1296923
Created October 18, 2011 22:26
Simple Page Scraping
<!DOCTYPE html>
<html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Simple Page Scraping</title>