Skip to content

Instantly share code, notes, and snippets.

View awrowse's full-sized avatar

Andy Rowse awrowse

  • AW Rowse Solutions
  • Bozeman, MT
View GitHub Profile
@awrowse
awrowse / html5_stub.html
Created February 16, 2012 15:14
HTML5 Page Stub
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
<meta name="description" content="Webpage for xxxx">
<!-- http://meyerweb.com/eric/tools/css/reset/ -->
<link rel="stylesheet" href="css/reset/reset.css">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
@awrowse
awrowse / return_401.php
Created February 16, 2012 15:26
PHP 401 Return
<?php
header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized', true, 401);
die('401 Unauthorized');
@awrowse
awrowse / dom_walk.js
Created February 16, 2012 16:00
JS Dom Walk
/**
* Recursive funciton to walk dom and replace any matched dictionary
* terms with a span tag and special css class
* @param element DOMElement
*/
function _walkElement(element){
//loop over all children of element
var el = element.firstChild;
if(el){
do{
@awrowse
awrowse / pub_ip_via_bash.sh
Created June 1, 2012 13:22
Find IP address from Bash Shell
#!/bin/bash
lynx -dump http://www.formyip.com/ | awk "/IP is/{print $NF}"
@awrowse
awrowse / build.xml
Created June 21, 2012 19:12
Java CWS ANT File
<?xml version="1.0" encoding="UTF-8"?>
<project default="all" name="DemoApp">
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.src.dir" location="${basedir}/src"/>
<property name="build.dir" location="${basedir}/bin"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="main-class" value="com.rightnow.ps.example.DemoApp"/>
<property file="${basedir}/antbuild.properties"/>
@awrowse
awrowse / DemoApp.java
Created June 22, 2012 21:28
Java CWS Demo
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rightnow.ps.example;
import com.rightnow.ws.base.*;
import com.rightnow.ws.faults.*;
import com.rightnow.ws.messages.*;
import com.rightnow.ws.objects.*;
@awrowse
awrowse / ui_alert.m
Created July 2, 2012 03:11
UI Alert Box
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"You pushed cancel" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alert show];
@awrowse
awrowse / dev_errors.php
Created July 2, 2012 15:16
PHP Dev Error Reporting
//Error Reporting for debugging. Comment out for deployment
ini_set('display_errors',1);
error_reporting(E_ALL ^ E_NOTICE);
@awrowse
awrowse / CPHPUtil.php
Created July 23, 2012 19:02
Connect PHP Utility
<?php
class CPHPUtil {
/**
* Find a LookupName's ID in Connect PHP
* @param string $label Label to find as lookup name
* @param string $field_name Field name to compare label against lookup names.
* @param string $object Object that contains the field to search
* @return int|boolean Returns ID if found, false otherwise
*/
@awrowse
awrowse / php_object_sort.php
Created September 12, 2012 21:47
PHP Object Sort Numeric
usort($navItems, function($x, $y){
if ($x->LinkOrder == $y->LinkOrder) { return 0; }
return ($x->LinkOrder < $y->LinkOrder) ? -1 : 1;
});