Skip to content

Instantly share code, notes, and snippets.

View keithhackbarth's full-sized avatar

Keith keithhackbarth

View GitHub Profile
@keithhackbarth
keithhackbarth / check_unstaged_changes.sh
Created March 22, 2024 22:39
Check for Unstaged Changes
#!/bin/sh
# Check for unstaged changes
[ `git status --porcelain=1 | wc -l` -ne 0 ] && echo "unstaged changes found" && exit 1
exit 0
@keithhackbarth
keithhackbarth / check_todos.sh
Last active March 22, 2024 22:38
Check Todos
#!/bin/bash
# Step 1: Store the modified output in a variable
todos=$(git grep -l TODO ./src | grep -v 'graphqlTypes' | xargs -n1 git blame -f -w | grep TODO | sed 's/\([0-9]\{2,\}\)) */\1) /')
# Step 2: Count the number of lines in the modified output
todo_count=$(echo "$todos" | grep -v '^$' | wc -l | sed 's/^[[:space:]]*//') # Remove leading spaces
# Step 3: Print the count in yellow text
if [ "$todo_count" -gt 0 ]; then
def test_patch_one_to_many(mutation, fruit, color):
result = mutation(
'{ fruit: updateFruits(data: { id: "1", color: { set: 1 } }) { color { name } } }',
)
> assert not result.errors
E assert not [GraphQLError("Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.", locations=[SourceLocation(line=1, column=12)], path=['fruit'])]
E + where [GraphQLError("Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.", locations=[SourceLocation(line=1, column=12)], path=['fruit'])] = ExecutionResult(data=None, errors=[GraphQLError("Expected Iterable, but did not find one for field 'GeoMutation.updateFruits'.", locations=[SourceLocation(line=1, column=12)], path=['fruit'])], extensions={}).errors
@keithhackbarth
keithhackbarth / Functions
Last active November 19, 2018 14:03
PostGis Encode Polyline
-- Based on the word done by elrobis
-- http://cartometric.com/blog/2014/01/27/postgresql-postgis-implementation-of-google-encoded-polyline-algorithm
CREATE OR REPLACE FUNCTION pim.encode_polyline(
in_wkt character varying
)
RETURNS character varying[] AS $$
DECLARE
g GEOMETRY;
BEGIN
@keithhackbarth
keithhackbarth / gist:6911472
Created October 10, 2013 01:16
Django admin - Some timezone blurb in admin so that user's are aware of either PST or UTC, etc.
{% extends "admin/base.html" %}
{% block extrahead %}
{{block.super}}
<script>
$(function () {
$('.datetime').append(
'<br>Times are shown in Pacific Standard Time' +
'<br>Be aware if you are editing information in another timezone'
);
});