Skip to content

Instantly share code, notes, and snippets.

View jdaily's full-sized avatar

John Daily Jr. jdaily

View GitHub Profile
@jdaily
jdaily / main.go
Created October 26, 2018 20:05
Interactive golang cli with promptui
package main
import (
"fmt"
"log"
"os"
"github.com/go-ozzo/ozzo-validation"
"github.com/go-ozzo/ozzo-validation/is"
"github.com/manifoldco/promptui"
@jdaily
jdaily / squash
Created March 10, 2016 18:34
Squash a Feature Branch against Master
git branch [Feature]-squashed
git checkout [Feature]-squashed
git reset --hard upstream/master
git merge --squash upstream/[Feature]
git commit -m "squashed [Feature] PR to one commit"
git push origin [Feature]-squashed
@jdaily
jdaily / pre-commit
Last active March 7, 2016 13:14 — forked from adamn/pre-commit
strict pep8, max-line-length=120
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@jdaily
jdaily / gist:d45a40022687ae94ffb6
Created March 27, 2015 17:37
Regular Expressions
US Domestic Phone Numbers
\(\d{1,3}\)([\s\.\-])\d{3,4}(?:\1|\-)?\d{4,6}\b
International Phone Numbers
\+\d{1,3}([\s\.\-])(?:\(\d{1,3}\)|\d{1,3})\1\d{3,4}(?:\1|\-)?\d{4,6}\b
Street Address
\b\d{1,7}(?:\-?[A-Z]?|st|nd|rd|th)(?:\s[\w']+){1,4}\s(?:W|E|N|S|NE|NW|SE|SW|ave|ct|street|st|dr|ln|rd|blvd)\b
@jdaily
jdaily / tz_world
Created February 11, 2015 14:48
MariaDB GIS TimeZones
wget http://efele.net/maps/tz/world/tz_world_mp.zip
unzip tz_world_mp.zip
ogr2ogr -progress -lco engine=MYISAM -f MySQL MySQL:test,user=root,password='password' world/tz_world.shp
@jdaily
jdaily / gist:1c7e86c4b1e7875ff876
Last active August 29, 2015 14:12
Google Play dotremote Apple Script
# Basic Play Options
## Play/Pause/Previous/Next
tell application "Google Chrome"
repeat with w in (every window)
repeat with t in (every tab whose URL contains "play.google.com/music") of w
# Options for action are:
# 1 = previous
# 2 = play/pause
# 3 = next
@jdaily
jdaily / gist:0df1ba5509df1be5f627
Created December 17, 2014 18:34
Mongo DateTime Parser in Scala
package models
import play.api.libs.json._
import org.joda.time.{DateTimeZone, DateTime, LocalDateTime}
import reactivemongo.bson.BSONDateTime
import reactivemongo.bson.BSONReader
import reactivemongo.bson.BSONWriter
object MongoDateTime {
@jdaily
jdaily / gist:b99ee42c3e260bdb53dd
Created November 23, 2014 02:13
MySQL GIS HAVERSINE
MySQL
CREATE DEFINER=`root`@`localhost` FUNCTION `HAVERSINE`(`coord1` POINT, `coord2` POINT) RETURNS double
NO SQL
BEGIN
DECLARE dist DOUBLE;
SET dist = ACOS( COS( radians( X( coord1 ) ) ) * COS( radians( Y( coord1 ) ) ) * COS( radians( X( coord2 ) ) ) * COS( radians( Y( coord2 ) ) ) + COS( radians( X( coord1 ) ) ) * SIN( radians( Y( coord1 ) ) ) * COS( radians( X( coord2 ) ) ) * SIN( radians( Y( coord2 ) ) ) + SIN( radians( X( coord1 ) ) ) * SIN( radians( X( coord2 ) ) ) ) * 6372.8;
RETURN dist;
END
// Photoshop Script to Create iPhone Icons from iTunesArtwork // // WARNING!!! In the rare case that there are name collisions, this script will // overwrite (delete permanently) files in the same folder in which the selected // iTunesArtwork file is located. Therefore, to be safe, before running the // script, it's best to make sure the selected iTuensArtwork file is the only // file in its containing folder. // // Copyright (c) 2010 Matt Di Pasquale // Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and
@jdaily
jdaily / dist-play-app-initd
Last active August 29, 2015 14:01 — forked from RadoBuransky/dist-play-app-initd
Updated to set Custom Log File for process output
#!/bin/bash
#
# =========================================================================
# Copyright 2014 Rado Buransky, Dominion Marine Media
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0