Skip to content

Instantly share code, notes, and snippets.

public boolean isInRegion(SimpleLocation location) {
if (location == null)
return false;
SimpleLocation lastPoint = area.get(area.size() - 1);
boolean isInside = false;
double x = location.getLongitude();
for (SimpleLocation point : area) {
double x1 = lastPoint.getLongitude();
double x2 = point.getLongitude();
double dx = x2 - x1;
@Inlustra
Inlustra / ArgumentParser.java
Last active August 29, 2015 14:27
Use Java to mimic the average bash commands with a dash
import java.util.HashMap;
import java.util.Map;
/**
*
* @author thomas
*/
public class ArgumentParser {
private static final Map<String, RunnableParam> arguments = new HashMap<>();
//Simple HSL Manipulation
/**
*
*
*
* Author: Thomas Nairn
*
*
*
*/
@Inlustra
Inlustra / killport.sh
Created June 14, 2016 10:20
Ubuntu 16.04: Kill application running on port script
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Please supply a port number: 'killport 9000'"
exit 1
fi
sudo kill `sudo lsof -t -i:$1`
@Inlustra
Inlustra / .zshrc
Last active November 20, 2017 11:39
.zshrc
source /usr/share/zsh-antigen/antigen.zsh
antigen use oh-my-zsh
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle git
antigen bundle zsh-users/zsh-completions
antigen bundle lukechilds/zsh-nvm
antigen bundle zpm-zsh/autoenv
# Usage: copyFromRemote <SSH Config Host> <remote file/dir> <local file/dir>
# Example: copyFromRemote myServer ~/remote/path ~/local/path
function copyFromRemote() {
rsync -avze ssh $1:$2 $3
}
# Usage: copyToRemote <SSH Config Host> <local file/dir> <remote file/dir>
# Example: copyToRemote myServer ~/local/path ~/remote/path
function copyToRemote() {
@Inlustra
Inlustra / .zshrc
Last active February 20, 2018 16:05
Antigen ZSHRC
source /usr/local/share/antigen/antigen.zsh
antigen use oh-my-zsh
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
antigen bundle git
antigen bundle lukechilds/zsh-nvm
antigen bundle zpm-zsh/autoenv
@Inlustra
Inlustra / .hyper.js
Last active April 9, 2018 15:51
Antibody + Hyper
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
summon: {
hideDock: false,
hideOnBlur: false,
@Inlustra
Inlustra / userChrome.css
Last active February 8, 2019 15:14
Hide Firefox tabs with spacing for Mac window buttons (v64)
#TabsToolbar-customization-target {
visibility: collapse;
}
toolbar#TabsToolbar {
min-height: 0 !important;
}
#nav-bar {
margin-left: 80px;
@Inlustra
Inlustra / paddingGenerator.js
Last active April 17, 2019 13:26
Super stupid css generator for spacing helper
function gen(sizes) {
const a = Object.keys(sizes).map(key => `.p-a-${key} { padding: ${sizes[key]}px; }`)
const x = Object.keys(sizes).map(key => `.p-x-${key} { padding-left: ${sizes[key]}; padding-right: ${sizes[key]}px; }`)
const y = Object.keys(sizes).map(key => `.p-y-${key} { padding-top: ${sizes[key]}; padding-bottom: ${sizes[key]}px; }`)
const t = Object.keys(sizes).map(key => `.p-t-${key} { padding-top: ${sizes[key]}px; }`)
const b = Object.keys(sizes).map(key => `.p-b-${key} { padding-bottom: ${sizes[key]}px; }`)
const l = Object.keys(sizes).map(key => `.p-l-${key} { padding-left: ${sizes[key]}px; }`)
const r = Object.keys(sizes).map(key => `.p-r-${key} { padding-right: ${sizes[key]}px; }`)
return a.concat(x, y, t, b, l, r)