Skip to content

Instantly share code, notes, and snippets.

View gist:dc3876f755fb395b6483
<?php
/*
Plugin Name: rewrite test
Description: rewrite test
Author: Nick
Version: 1.0
*/
register_activation_hook(__FILE__, 'activate');
View gist:ea8eb4733636ef624258
/*
here is the json being passed into the function when the user clicks on the routes dropdown box
{"locations":[{"latitude":"47.610000","longitude":"-122.330000","speed":"0","direction":"0","distance":"0.0","location_method":"na","gps_time":"Jan 3 2007 01:37PM","user_name":"wordpressUser2","session_id":"8BA21D90-3F90-407F-BAAE-800B04B1F5EA","accuracy":"137","extra_info":"na"}]}
{"locations":[{"latitude":"47.610000","longitude":"-122.330000","speed":"0","direction":"0","distance":"0.0","location_method":"na","gps_time":"Jan 3 2007 01:37PM","user_name":"wordpressUser","session_id":"8BA21D90-3F90-407F-BAAE-800B04B1F5EC","accuracy":"137","extra_info":"na"}]}
*/
function loadGPSLocations(json) {
View gist:bccdabbb25a0cc052c2d
<?php
defined('ABSPATH') or exit;
/*
Plugin Name: Gps Tracker Endpoint
Plugin URI: https://www.websmithing.com/gps-tracker
Description: Create an endpoint for Gps Tracker.
Version: 1.0.0
Author: Nick Fox
Author URI: https://www.websmithing.com/hire-me
License: GPL2
View gist:a2cbf7d73f74dc6be0d8
$gps_time = urldecode($wp_query->query_vars['gpstime']);
// gpstime of '0000-00-00 00:00:00' is how we determine if its a nonce request
if ($gps_time == '0000-00-00 00:00:00') {
$session_id = $wp_query->query_vars['sessionid'];
$session_id_pattern = '[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}';
if (preg_match($session_id_pattern, $session_id)) {
$wpnonce = wp_create_nonce($session_id);
} else {
View gist:01da4a62772a7f541f6c
night:/home/nick/node/sunsetvote# sysctl -a | grep bindv6only
error: "Invalid argument" reading key "fs.binfmt_misc.register"
error: permission denied on key 'net.ipv4.route.flush'
error: permission denied on key 'net.ipv6.route.flush'
net.ipv6.bindv6only = 0
View gist:8162eeec0a0a0b6eb09e
night:/home/nick/node/sunsetvote# netstat -anp 2> /dev/null | grep :3000
tcp6 0 0 :::3000 :::* LISTEN 20918/node
View gist:98c8811309a97fcfa79f
curl 7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
root@night:/home/nick/node/sunsetvote# curl -v localhost:3000/helloworld
* About to connect() to localhost port 3000 (#0)
* Trying 127.0.0.1... connected
> GET /helloworld HTTP/1.1
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:3000
> Accept: */*
View gist:a0c33a8c8bd864f959bf
#!/usr/bin/env node
var debug = require('debug')('sunsetvote');
var app = require('../app');
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
View gist:b849538f89c15998fe25
{
"name": "sunsetvote",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"express": "~4.2.0",
"static-favicon": "~1.0.0",
View gist:deef567fed9526311b7c
var express = require('express');
var path = require('path');
var favicon = require('static-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
You can’t perform that action at this time.