Skip to content

Instantly share code, notes, and snippets.

View steveoh's full-sized avatar
🚀

steveoh steveoh

🚀
View GitHub Profile
@steveoh
steveoh / test.py
Created February 7, 2017 23:16
test insert and join vs in where clause
#!/usr/bin/env python
# * coding: utf8 *
'''
test.py
A module that tests inserting and joining records
'''
import arcpy
from os.path import basename
@steveoh
steveoh / init.js
Created January 31, 2017 00:07
an atom command to remove common python debug statements. open your atom config folder. possibly rename init.cson to init.js and place this your file.
atom.commands.add('atom-text-editor', 'custom:remove-debug', () => {
const editor = atom.workspace.getActiveTextEditor();
const range = editor.getBuffer().getRange();
const checkpoint = editor.createCheckpoint();
const regex = new RegExp(/\s*from nose.tools import set_trace\s*set_trace\(\)$|\s*import pdb;?\s*pdb.set_trace\(\)$/, 'gmi');
editor.backwardsScanInBufferRange(regex, range, (iterator) => {
iterator.replace('');
});
@steveoh
steveoh / .gitignore
Created October 17, 2016 17:24
inverting the gitignore
*
*\**/**
!src/app/
src/app/**/*.css
!src/ChangeLog.html
!src/index.html
!profiles/
!.github/
!.gitignore
!_SpecRunner.html
@steveoh
steveoh / fouled_up_column.py
Last active October 19, 2022 03:50
RuntimeError: A column was specified that does not exist. How to find which field
#: the fields in the feature class
actual = set([str(x.name) for x in arcpy.ListFields(r'')])
#: the fields you are trying to use
expected = set([])
fouled_up = expected - actual
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
public static class ModelStateDictionaryExtensions
{
public static IEnumerable<string> ToErrors(this ModelStateDictionary dict)
{
return dict.OrderBy(kvp => kvp.Key)
@steveoh
steveoh / updateNugets.cs
Created October 8, 2013 22:05
basic idea for updating nuget packages
using System.IO;
using System.Xml.Linq;
using System.Xml.XPath;
using System.Diagnostics;
//version could probably come from REPL input or something
string version = "1.9.1";
/* bunch of file and folder moving around */
@steveoh
steveoh / soe.csproj
Last active December 17, 2015 20:59
automated soe updating
<Project DefaultTargets="UpdateSOE" ...>
<Target Name="UpdateSOE" DependsOnTargets="Build">
<!-- Python needs to be in the path -->
<Exec Command="python $(MSBuildProjectDirectory)\PostBuildEvents\Runner.py"/>
</Target>
</Project>