Skip to content

Instantly share code, notes, and snippets.

View geoluther's full-sized avatar

George geoluther

  • Boulder, CO
View GitHub Profile
@geoluther
geoluther / wp_max_image_size
Created June 17, 2018 03:43
limit wordpress image size
<?php
function nelio_max_image_size( $file ) {
$size = $file['size'];
$size = $size / 1024;
$type = $file['type'];
$is_image = strpos( $type, 'image' ) !== false;
$limit = 250;
$limit_output = '250kb';
// mongo shell query to find date range, 120 = number of minutes
query = { date: { $gt: new Date(ISODate().getTime() - 1000 * 60 * 120) } }
@geoluther
geoluther / web-servers.md
Created February 21, 2017 21:47 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
$json = array();
$result = mysqli_query ($connection, $query);
while($row = mysqli_fetch_array ($result))
{
$data = array(
'field1' => $row['field1'],
'field2' => $row['field2']
);
array_push($json, $data);
}