Skip to content

Instantly share code, notes, and snippets.

@JeffJacobson
JeffJacobson / project-coordinate-arrays.js
Created January 30, 2014 20:51
Project arrays of coordinates using Proj4JS
// For use withhttp://proj4js.org/
/** @typedef {(string|proj4.Proj)} Projection
*
*/
/** @typedef {object} ThisProjectionInfo
* @property {?Projection} inPrj
* @property {?Projection} outPrj
*/
@JeffJacobson
JeffJacobson / jsdoc.txt
Created March 27, 2014 17:16
Convert JSDoc property descriptions to C# properties using Regex search & replace in Visual Studio

Property Regex:

^\s*\*\s@property\s{(\w+)}\s(\w+)(?:\s*-\s*)?([^\r\n]+)\s*$

Captures

  1. type name
  2. property name
  3. property description

Replace:

/// $3\npublic $1 $2 { get; set; }

@JeffJacobson
JeffJacobson / JSON_UDL.xml
Last active August 29, 2015 14:03
Notepad++ User Defined Languages
<NotepadPlus>
<UserLang name="JSON" ext=".json" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments"></Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@JeffJacobson
JeffJacobson / pills.md
Last active August 29, 2015 14:12
Pill Organizer

Don't wait until the end of the week to refill the pill organizer.

  • Starting on Tuesday, start refilling the pillbox for the next week.
  • Leave a blank day before the current day to avoid confusion (e.g., forgetting what day it is and taking the next day's dose).

Sunday

Sun. Mon. Tue. Wed. Thu. Fri. Sat.
Take 💊 💊 💊 💊 💊 💊 💊
@JeffJacobson
JeffJacobson / extractattachments.py
Created February 4, 2015 00:06
Extract attachments from a file geodatabase
"""Extracts attachments from a file geodatabase.
"""
import os, re
from os.path import join, exists
from arcpy import da
def extract_attachments(gdb, attachment_dir="images"):
"""Extract attachments from a geodatabase to the filesystem.
"""
attach_table_name_re = re.compile(r"^\w+(?=__ATTACH$)", re.IGNORECASE)
@JeffJacobson
JeffJacobson / FileSystemExtensions.cs
Created February 27, 2015 01:40
Utilities for walking through file systems
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
public static class FileSystemExtensions
{
/// <summary>
@JeffJacobson
JeffJacobson / Test_simpleGeometry.py
Created January 3, 2012 17:58
simplegeometry: A module for working with OGC Simple Geometry definitions. Designed for use with SQL Server 2008 WKT strings.
import simplegeometry
parsedG = simplegeometry.parseline("MULTILINESTRING ((1208120.9130000025 745513.05599999428 NULL 20, 1208147.5579999983 746483.423999995 NULL 20.182, 1208156.1369999945 746685.62999999523 NULL 20.22, 1208167.1659999937 746871.90399999917 NULL 20.255, 1208183.0980000049 747065.53200000525 NULL 20.292, 1208224.0849999934 747534.46500000358 NULL 20.38, 1208278.5320000052 748175.35199999809 NULL 20.503, 1208298.1400000006 748436.38099999726 NULL 20.553, 1208316.5219999999 748766.0380000025 NULL 20.616, 1208325.6720000058 748994.7880000025 NULL 20.66, 1208329.1790000051 749297.90999999642 NULL 20.719, 1208322.6490000039 749569.95900000632 NULL 20.772, 1208314.0709999949 749826.0869999975 NULL 20.822, 1208285.8959999979 750428.78900000453 NULL 20.94, 1208283.375 750469.80500000715 NULL 20.95, 1208271.1790000051 750746.43000000715 NULL 20.999, 1208265.050999999 751041.77300000191 NULL 21.05, 1208273.4159999937 751666.8180000037 NULL 21.16, 1208281.0789999962 752090.83499999344 NULL 21.242, 120
@JeffJacobson
JeffJacobson / exportlegend.py
Created January 3, 2012 19:07
Exports the legend from an ArcGIS Server map service as an HTML document.
"""Exports the legend from an ArcGIS Server map service as an HTML document.
Parameters:
0 ArcGIS Server map service legend URL
1 Inline Images (optional)
If this parameter is set to any value, the images will be included inline
in the CSS instead of being saved to separate image files. (Note that this
method is not supported by Internet Explorer 7.)
"""
import sys, re, base64, httplib, json
@JeffJacobson
JeffJacobson / CopyFilesForDate.py
Created January 4, 2012 22:12
Copies files and appends to the copies' filenames the date nearest the 15th or last day of the month, or nearest weekday.
"""Creates copies of the timesheet files for the current pay period.
Place this file in the same directory as your timesheet FileMaker Pro files.
When you run this script, it will make copies of the files and append the
date of the last day of the current pay period.
"""
import sys, os, shutil, datetime, calendar
# Get today's date.
today = datetime.date.today()
@JeffJacobson
JeffJacobson / removeExcludeExtension.py
Created February 1, 2012 23:45
Remove ".exclude" extension from all files in a directory without losing SVN history
"""Remove the ".exclude" extension from all files in this directory.
"""
import os, re, pysvn
# Get all of the files in the directory.
excludeFiles = os.listdir('.')
# Filter so only those ending with ".exclude" are in the list.
regex = re.compile('.+\.exclude$', re.IGNORECASE)
excludeFiles = filter(lambda f: regex.search(f), excludeFiles)