Skip to content

Instantly share code, notes, and snippets.

@oeon
oeon / st_intersects_within.sql
Created Jan 12, 2020
where ESA is a polygon layer. Use PostGIS to test in/out
View st_intersects_within.sql
-- inside ESA
UPDATE htmp points SET esa = 'yes'
FROM
(SELECT DISTINCT(poi.*)
FROM vm_esa pol
JOIN htmp poi
ON (ST_Within(poi.geom, pol.geom))) inside
WHERE points.legacy_fulcrum_id = inside.legacy_fulcrum_id;
-- outside ESA
@oeon
oeon / gist.sql
Created Jan 7, 2020
unnested photo array - captions...aggregated back together
View gist.sql
select _record_id, string_agg(unnest, ', ') as photos, string_agg(photos_captions, ', ') as photos_captions from (select r._record_id, r.unnest, k.labels as photos_captions from records r join rek k on k.photo = r.unnest order by _record_id) a group by _record_id order by _record_id
@oeon
oeon / gist:84b54ace2090904ca7ac08f2b1cbdfcc
Created Nov 8, 2019
run this to fix that: RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" asdf install ruby 2.2.4
View gist:84b54ace2090904ca7ac08f2b1cbdfcc
ruby-build: using openssl from homebrew
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
Installing ruby-2.2.4...
WARNING: ruby-2.2.4 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
^[[A
@oeon
oeon / fulcrum-routing-data-event.js
Created Oct 27, 2019
Using Fulcrum Data Events for routing with Google Maps and MAPS.ME
View fulcrum-routing-data-event.js
ON('change', 'routing_options', () => {
if ($routing_options == 'google') {
if (LATITUDE() && LONGITUDE()) {
OPENURL('https://maps.google.com/?q=' + LATITUDE() + ',' + LONGITUDE());
} else {
ALERT('No location provided!', 'A location is required to show Google Maps.')
}
SETVALUE('routing_options', null);
} else if ($routing_options == 'mapsme') {
let location = CURRENTLOCATION();
View index.html
<iframe width=100% height=100% src="https://docs.google.com/spreadsheets/d/e/2PACX-1vQvHvzsKhqm4JLIJGhBcrYrZbcKQKHFzg1CBPggQ5CsCOUcvNGYcJE_qop1dOa5VoQN7Ekb84Tqbq02/pubhtml?widget=true&amp;headers=false"></iframe>
View split-csv.md

this has been slightly modifed for my use cases ~joe

I've had to deal with uploading big data csv files a lot. It's a pain when you encounter timeouts and upload limits, sometimes your only choice is to split the file into smaller files.

I want to show you how to do this in 3 easy steps with the Terminal!

Splitting the file:

split -l 10000 companies.csv ./split-files/chunk-
View keybase.md

Keybase proof

I hereby claim:

  • I am oeon on github.
  • I am oeon (https://keybase.io/oeon) on keybase.
  • I have a public key ASBW-ZRiTH19DIblcsIb3JYMvdRsa5-xRWBdXcAPL8nnTQo

To claim this, I am signing this object:

@oeon
oeon / scripts.gs
Created Feb 6, 2019
Google Apps Script for creating Google Calendar events via Fulcrum Webhooks with Location
View scripts.gs
// Google Apps Script for creating Google Calendar events via Fulcrum Webhooks
// replace your Fulcrum API token here
var token = "";
// leave createEventId as an empty string. We'll get it in createEvent()
var createEventId = "";
function doPost(e) {
return handleResponse(e);
}
@oeon
oeon / calc.js
Created Jan 10, 2019
Unix time calculation for Fulcrum date and time fields
View calc.js
var stop = new Date($stop_date.getFullYear(), $stop_date.getMonth(), $stop_date.getDate(), $stop_time.slice(0, 2), $stop_time.slice(3, 5), 0);
SETRESULT(stop.getTime());
@oeon
oeon / calc.js
Created Jan 10, 2019
Unix time calculation for Fulcrum date and time fields
View calc.js
var start = new Date($start_date.getFullYear(), $start_date.getMonth(), $start_date.getDate(), $start_time.slice(0, 2), $start_time.slice(3, 5), 0);
SETRESULT(start.getTime());
You can’t perform that action at this time.