Skip to content

Instantly share code, notes, and snippets.

View chrismeller's full-sized avatar

Chris Meller chrismeller

View GitHub Profile
@chrismeller
chrismeller / keybase.md
Created February 19, 2014 18:01
keybase.md

Keybase proof

I hereby claim:

  • I am chrismeller on github.
  • I am chrismeller (https://keybase.io/chrismeller) on keybase.
  • I have the public key with fingerprint BE47 C054 3F06 0391 DAF3  51BE 7C2E 30CD 9EDF 58DD

To claim this, I am signing this object:

@chrismeller
chrismeller / gist:10912818
Created April 16, 2014 17:47
Nginx vhost redirect to ssl
server {
include listen_80;
server_name www.example.com;
rewrite ^ https://www.example.com$request_uri$is_args$args;
}
@chrismeller
chrismeller / gist:10912995
Created April 16, 2014 17:48
Nginx vhost redirect only certain URIs to ssl
server {
include listen_80;
server_name www.example.com;
root /home/chris/public_html/www.example.com/public;
access_log /home/chris/public_html/www.example.com/logs/access.log;
error_log /home/chris/public_html/www.example.com/logs/error.log;
location ~ /\.git {
deny all;
"ranges": {
"Exxon Mobil": [
"192.67.48.0/24",
"158.35.254.0/24",
"158.35.252.0/24",
"158.35.238.0/23",
"158.35.225.0/24",
"158.35.223.0/24",
"158.35.176.0/22",
"158.35.0.0/16",
@chrismeller
chrismeller / gist:ae453245ff5a8d878c55
Last active August 29, 2015 14:06
Bookmarklet for Jumping to Harvest Monthly Report
javascript:
var this_month = new Date();
var first_day = new Date(this_month.getFullYear(), this_month.getMonth(), 1);
var last_day = new Date(this_month.getFullYear(), this_month.getMonth() + 1, 0);
var first_year = first_day.getFullYear();
var first_month = first_day.getMonth();
var first_date = first_day.getDate();
var last_year = last_day.getFullYear();
server {
listen [::]:80;
listen *:80;
server_name blog.chrismeller.com;
root /home/chris/public_html/blog.chrismeller.com/public;
access_log /home/chris/public_html/blog.chrismeller.com/logs/access.log;
error_log /home/chris/public_html/blog.chrismeller.com/logs/error.log;
location ~ /\.git {
@chrismeller
chrismeller / gist:630321
Created October 16, 2010 22:01
Habari Taxonomy Structure Example
<?php
class Term extends QueryRecord {
protected $vocabulary; // set by child classes to indicate which vocabulary your term relates to
// these two would be emulated by __get() and __set() so that they're actually stored in $this->fields
// for QueryRecord to work but this would be the public API
public $term; // the slugified version of the term name
public $display; // the raw term name for display
<?php
$file = $argv[1];
$type = isset( $argv[2] ) ? $argv[2] : 'php';
$contents = file_get_contents( $file );
$url = 'http://localhost/test/post.php';
$options = array(
<?php
$results = $db->get_results( 'select name, value from options' );
$options = new stdClass();
foreach ( $results as $result ) {
$options->{$result->name} = $result->value;
}
<?php
define('UNIT_TEST', true);
include('index.php');
header( 'Content-Type: text/html;charset=utf-8' );
$url = '&#104;&#116;&#116;&#112;&#58;&#47;&#47;&#1087;&#1088;&#1080;&#1084;&#1077;&#1088;&#46;&#1080;&#1089;&#1087;&#1099;&#1090;&#1072;&#1085;&#1080;&#1077;';
$url = html_entity_decode( $url, null, 'UTF-8' );
Utils::debug($url);