Skip to content

Instantly share code, notes, and snippets.

View phpmaps's full-sized avatar
💭
Lending a helping hand on the web.

Doug Carroll phpmaps

💭
Lending a helping hand on the web.
View GitHub Profile
@phpmaps
phpmaps / contentEditable.js
Created March 17, 2021 21:11
contentEditable
// https://stackoverflow.com/questions/6536166/how-to-find-absolute-or-relative-position-of-last-letter-inside-an-input-field
<div id="textbox">
<span id="edit" contentEditable></span>
<span id="end"></span>
</div>
<div id="report">x:? , y:?</div>
// css
#textbox {
@phpmaps
phpmaps / onScrollStop.ts
Created March 17, 2021 14:43
onScrollStop
const onScrollStop = (el, callback) => {
if (!callback || typeof callback !== 'function') return;
if(!el) return;
let isScrolling;
el.addEventListener('scroll', (event) => {
el.clearTimeout(isScrolling);
@phpmaps
phpmaps / gulp.js
Last active February 5, 2021 18:35
A build folder cleanup script
const fs = require('fs-extra');
const path = require('path');
const {
src,
dest,
series,
task
} = require('gulp');
const argv = require('yargs').argv;
@phpmaps
phpmaps / Fire_Science.md
Last active February 23, 2020 22:47
Science Fair

Fire Science

Spatial Data Prerequisites

  • Counties (polygons)
  • Roads (polylines)
  • Fires (points)
  • Parks (polygons)
@phpmaps
phpmaps / df.py
Created February 7, 2020 23:12
dataframe pandas
import pandas as pd
import numpy as np
df = pd.DataFrame(np.array([
["1001 19th St North", "Arlington", "VA", "Esri R&D"],
["380 New York St", "Redlands", "CA", "Esri Headquarters"],
["920 SW #rd Avenue", "Portland", "OR", "Esri R&D"],
["75 Broad St", "New York City", "NY", "Esri Regional Office"]
]), columns=["Address", "City", "State", "Office"])
@phpmaps
phpmaps / move_to_marketing.py
Created August 19, 2019 21:40
move_to_marketing.py
import boto3
heartland_campaign = heartland.nlargest(3, 'population')
heartland_campaign.to_csv(r'heartland_campaign.csv')
s3 = boto3.resource('s3')
s3.meta.client.upload_file('heartland_campaign.csv', 'online-store-marketing', 'heartland_campaign.csv')
@phpmaps
phpmaps / flight.geojson
Last active July 15, 2019 04:57
flight
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phpmaps
phpmaps / snowfall.py
Created July 3, 2019 18:39
snowfall / s3
import datetime as dt
import pandas as pd
import os
from six.moves import urllib
year = "2019"
## Get the data from the web
path = "ca_snow_feb_{}.csv".format(year)
url = "https://s3-us-west-1.amazonaws.com/python-and-r/ca_snow_feb_{}.csv".format(year)
@phpmaps
phpmaps / log.json
Created February 12, 2019 04:30
log showing jupyter message queue is random, not sequential
{
"hasMore": false,
"startTime": 1549945703204,
"endTime": 1549945477363,
"logMessages": [
{
"type": "DEBUG",
"message": "Getting all services in federated mode.",
"time": 1549945703204,
"source": "Admin",
@phpmaps
phpmaps / bodyBuilder.java
Created December 17, 2018 23:36
bodyBuilder
public List<NameValuePair> bodyBuilder(Map<String, String> map) {
List<NameValuePair> paramList = new ArrayList<>(map.size());
for (Map.Entry<String, String> entry : map.entrySet()) {
paramList.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
return paramList;
}