Skip to content

Instantly share code, notes, and snippets.

View kellymears's full-sized avatar

Kelly Mears kellymears

View GitHub Profile
@kellymears
kellymears / httpd.conf
Created July 13, 2012 16:11
example MAMP httpd.conf
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@kellymears
kellymears / template-archive-query.php
Created July 24, 2012 14:16
Post Archive Factory
<?php
/**
* Template Name: Archive Query
* Description: Retrieves Posts
*
* @package Toolbox
* @since Toolbox 0.1
*/
get_header(); ?>
// Original PHP code by Chirp Internet: www.chirp.com.au
// Please acknowledge use of this code by including this header.
function myTruncate($string, $limit, $break=".", $pad="...")
{
// return with no change if string is shorter than $limit
if(strlen($string) <= $limit) return $string;
// is $break present between $limit and the end of the string?
if(false !== ($breakpoint = strpos($string, $break, $limit))) {
@kellymears
kellymears / functions.php
Created August 21, 2012 17:18
registering & deregistering jquery scripts on as-needed basis
<?php // this is an excerpt from functions.php ?>
<?php
function register_ueg_scripts($version='development') {
$template = get_template_directory_uri();
// jquery
wp_register_script('jquery','/js/jquery.1.7.1.min.js');
@kellymears
kellymears / convioManualSubmissionCount.js
Last active January 27, 2018 23:05
Convio's submission total sucks so I built a new one with a signer bar
function addCommas(nStr) {
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
/* get_group_members($group_id)
* ---------------------------------------------
* return multidimensional array of constituents
* in a particular group including address, contact
* information.
*
*/
function get_group_members($group_id) {
$this->convio_data['group_id'] = $group_id;
@kellymears
kellymears / legislatorLookupProcessing.php
Last active January 27, 2018 23:01
Business logic to determine if constituent rep had cosponsored a bill
<?php
// RESULTS
if(in_array($legislator_id, $cosponsor_ids)) {
// echo "Your representative, $legislator_first $legislator_last, is a cosponsor of the legislation.";
/* $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://endgenocide.org/actions/protect-the-rohingya/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@kellymears
kellymears / convioRecurringDonations.php
Last active January 27, 2018 22:58
getting recurring donors from Convio API (for SaveDarfur.org)
public function get_recurring_gifts($cons_id) {
$this->log_message('get_recurring_gifts() called.');
if($cons_id) {
$convio_data['cons_id'] = $cons_id;
$response = $this->convio_api->call('SRRecurringAPI_getRecurringGifts', $convio_data);
} else $this->log_error("get_recurring_gifts(): no cons_id specified.");
if($response) do_method_output($response);
else $this->log_error('get_recurring_gifts(): no response from convio.');
}
@kellymears
kellymears / example.gmx
Last active January 27, 2018 22:56
GameMaker example for Aaron
/* State determination */
// --------------------------------
if(instance_exists(obj_player)) {
// enemy sees player
if(!collision_line(x,y,obj_player.x,obj_player.y,obj_wall,1,0)) {
state_attacking = 1;
state_pursuing = 1;
state_doubt = 0;
image_angle = point_direction(x,y,obj_player.x,obj_player.y);
// budi's CS:GO config
// Updated 1/28/2016
// Rates
rate "128000"
cl_cmdrate "128"
cl_updaterate "128"
cl_interp "0.0"
cl_interp_ratio "1"
cl_lagcompensation "1"