Skip to content

Instantly share code, notes, and snippets.

View stupiddingo's full-sized avatar

Brent stupiddingo

View GitHub Profile
@stupiddingo
stupiddingo / observations-schema.md
Created March 7, 2018 18:41
Observations Schema

SpeciesID (Entity Reference)

  • valid nodeid or uuid

Species Confidence (List - Text) Precise|Precise Confident|Confident Probably|Probably Best Guess|Best Guess Maybe|Maybe

@stupiddingo
stupiddingo / README.md
Last active September 13, 2016 03:48
Manipulating Weed Control Actions using tokenized requests to the Species API
@stupiddingo
stupiddingo / Test CORS
Last active April 7, 2016 18:47
Test Cross-Origin Resource Sharing
<html>
<head>
<title>Test CORS</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" media="all" rel="stylesheet"/>
</head>
<body>
<div class="container">
<h1>Test Cross-Origin Resource Sharing</h1>
<form>
<p>Cross-Origin Resource Sharing (CORS) is a specification that enables truly open access across domain-boundaries. If you serve public content, please consider using CORS to open it up for universal JavaScript/browser access. Learn more at <a href="http://enable-cors.org" title="Enable CORS">enable-cors.org</a></p>
@stupiddingo
stupiddingo / git-notes.md
Last active October 21, 2015 17:00
Git Notes

Ignoring locally changed file, e.g. settings.php, .htaccess.

git update-index --assume-unchanged <file>

Removing pushed tags

$ git tag -d <tagname>
$ git push origin :
@stupiddingo
stupiddingo / windows-drupal.md
Last active April 21, 2017 06:04
Setting up a Drupal Development Environment on Windows 7
  1. Install AMP Environment ========== Install Acquia Dev Desktop, XAMPP or similiar WAMP environment.

Acquia Dev Desktop

  • Download from http://www.acquia.com/downloads
  • Choose the latest installation for Windows
  • I'd recommend you accept the defaults
  • When you get to "Drupal Settings" I'd recommend writing down the Username and Password for your default site, though this may be retrieved if lost. Also, if you choose an idfg email, the emails will be delivered from the localhost server.
@stupiddingo
stupiddingo / multipoint-to-point.php
Last active August 29, 2015 14:16
MultiPoint to Point
<?php
echo "id,lon,lat<br/>";
$row = 1;
if (($handle = fopen("file.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if ($row != 1) {
$locs = explode("-", $data[1]);
foreach($locs as $loc) {
if (trim($loc) != "") {
echo $data[0] . ",-".trim($loc) . "<br/>";
@stupiddingo
stupiddingo / Weed node object for create or update
Last active July 14, 2016 17:20
This is an example node for POST or PUT to the https://fishandgame.idaho.gov/species/rest/node.json endpoint. Requires a valid cookie, X-CSRF-Token and appropriate credentials.
{
"type": "weed_control",
"title": "My title",
"log": "Revision log entry."
"field_data_entry_notes": {
"und": [
{
"value": "Basic notes about the weed control event."
}
]

#Node Resource

##Create

  • Args: node*
  • HTTP Method: POST
  • Content Type: application/json
  • Headers: X-CSRF-Token required.
  • Example URL: https://fishandgame.idaho.gov/species/rest/node.json
  • Example Content: {"type":"observation","field_species":{"und":[{"nid":"[nid:80612]"}]},"field_location":{"und":[{"geom":"{\"type\":\"Point\",\"coordinates\":[-112.0, 43.5]}"}]},"field_datetime":{"und":[{"value":{"date":"07/16/2013","time":"11:14am"}}]}}
  • Note: This is the minimum required fields for a valid observation: field_species, field_location and field_datetime.