Skip to content

Instantly share code, notes, and snippets.

View everdaniel's full-sized avatar
🏠
Working from home

Ever Daniel Barreto everdaniel

🏠
Working from home
View GitHub Profile
Script baseLineData execution took 0.31350111961365 seconds <br />Array
(
[0] => Array
(
[0] => 21
[1] => 21
[2] => 21
[3] => 21
[4] => 21
[5] => 21
Script baseLineData execution took 0.33139801025391 seconds <br />Array
(
[1] => Array
(
[6] => Array
(
[median] => 19
[minimum] => 18
[maximum] => 22
)
Script baseLineData execution took 0.32932496070862 seconds <br />Array
(
[1] => Array
(
[6] => Array
(
[213] => 19
[183] => 22
[184] => 22
[185] => 21
Array
(
[0] => Array
(
[high_rva] => Array
(
[0] => stdClass Object
(
[demand_id] => 22
[si] => 0.41666666666667
Array
(
[0] => Array
(
[high_rva] => Array
(
[0] => stdClass Object
(
[22] => 0.41666666666667
)
// do the comparison between baseline and current dataset here
foreach(array('high_rva', 'mid_rva', 'low_rva') as $type) {
$si = 1;
for($i = 0; $i < count($this->baseline_dataset[$type]); $i++) {
// calculate Hydrologic Alteration Factor
$observed_frequency = $this->comparison_dataset[$type][$i];
$expected_frequency = $this->baseline_dataset[$type][$i] * ($this->years_post / $this->years_pre);
<?php
/*
Plugin Name: Posts 2 Posts List Widget
Plugin URI: http://friendlywebconsulting.com/
Description: Creates a widget to display posts connected via the Posts 2 Posts plugin by Scribu, found here: http://wordpress.org/extend/plugins/posts-to-posts/
Author: Michelle McGinnis
Author URI: http://friendlywebconsulting.com/
Version: 1.0.0-alpha
*/
<?xml version='1.0' encoding='UTF-8'?>
<ResponseDetails>
<Result>Fail</Result>
<ErrorSeverity>Error</ErrorSeverity>
<ErrorDetails></ErrorDetails>
</ResponseDetails>
@everdaniel
everdaniel / wp_caption.php
Created October 23, 2013 22:30
WordPress Image Caption Filter
<?php
add_filter( 'img_caption_shortcode', 'cleaner_caption', 10, 3 );
function cleaner_caption( $output, $attr, $content ) {
$output2 = null;
$output3 = null;
$pattern = 'http://';
/* We're not worried abut captions in feeds, so just return the output here. */
@everdaniel
everdaniel / jsonapi.md
Created December 10, 2013 03:03 — forked from wycats/jsonapi.md

JSON API

There are two JSON API styles:

  • The ID Style
  • The URL Style

The ID style is the easiest to get started with, but requires that your clients be able to guess the URLs for related documents. It also locks your API into a particular URL structure, which may become a problem as your API grows.

The URL style requires less guessing on the client side, and makes clients more resilient to API changes, but is trickier to use with relationships and compound documents.