Skip to content

Instantly share code, notes, and snippets.

@jsundram
jsundram / cull.py
Last active April 5, 2023 15:22
Check if lat long is inside the bounds of the continental US (box model, not shape)
# http://en.wikipedia.org/wiki/Extreme_points_of_the_United_States#Westernmost
top = 49.3457868 # north lat
left = -124.7844079 # west long
right = -66.9513812 # east long
bottom = 24.7433195 # south lat
def cull(latlngs):
""" Accepts a list of lat/lng tuples.
returns the list of tuples that are within the bounding box for the US.
NB. THESE ARE NOT NECESSARILY WITHIN THE US BORDERS!
@roalcantara
roalcantara / gist:2345556
Created April 9, 2012 19:00
JAVA > Hibernate > @Embedded > Custom Column Names
@Embeddable
public class Phone {
private String number;
private String extensionNumber;
//ctors
//getters/setters
}
@willurd
willurd / web-servers.md
Last active July 25, 2024 21:14
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@thom-nic
thom-nic / build.gradle
Last active November 16, 2023 07:35
find the largest classnames in Spring libraries. Also find FactoryFactories
/**
* Find the longest class names in Spring.
* Also find FactoryFactory classes.
* a goof-off project by @thom_nic
*/
import java.util.jar.*
defaultTasks 'longest', 'factoryfactory'
@jeffsheets
jeffsheets / SpringPropertiesConfig.java
Created August 14, 2014 21:21
Spring 4 Properties Java Configuration with Database-backed Properties along with File properties too
/**
* Example of Spring 4 Properties Java Configuration,
* with a Database Properties table to store most values
* and a small application.properties file too.
* The Database table will take precedence over the properties file with this setup
*/
@Configuration
@PropertySource(value = { "classpath:application.properties" }, ignoreResourceNotFound=true)
public class SpringPropertiesConfig {
private static final Logger log = LoggerFactory.getLogger(SpringPropertiesConfig.class);
@jaibeee
jaibeee / brew-perms.sh
Last active February 15, 2024 22:49
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew