Skip to content

Instantly share code, notes, and snippets.

@mudpuddle
mudpuddle / README.md
Last active December 27, 2015 11:59
launchd script to open webpage everyday at a certain time

The plist file goes one of 3 places:

  • System Tasks - /Library/LaunchDaemons/
  • If Any User Logged In - /Library/LaunchAgents/
  • Only If You Are Logged In - ~/Library/LaunchAgents/

The script can be anywhere, but it needs to be executable

chmod 755 --path to script file

In the LaunchAgent folder type the following...

Excel Lookup
=INDEX(array of information you would like to have returned, MATCH(corresponding cell you would like to match to, array of matching info corresponding to the column of info you would like to have returned, 0))
@mudpuddle
mudpuddle / Command Line MS SQL Server
Created October 29, 2013 21:47
SQL Server Stuff to Remember.
-- osql -U<username> -P<password> -S<server> -i<path to sql script> -o<output>
@mudpuddle
mudpuddle / indexOfPrototype.js
Created July 30, 2013 18:43
Needed to add indexOf functionality to older browsers including IE8
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
@mudpuddle
mudpuddle / LatLonToMercator.js
Last active December 20, 2015 10:20
Convert WGS 84 Lat/Long to Web Mercator
function LatLonToMercator(lat, lon) {
var rMajor = 6378137; //Equatorial Radius, WGS84
var shift = Math.PI * rMajor;
var x = lon * shift / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * shift / 180;
return {'X': x, 'Y': y};
}
@mudpuddle
mudpuddle / MercatorToLatLon.js
Last active November 2, 2024 07:36
Convert Web Mercator to WGS 84 Lat/Long
function MercatorToLatLon(mercX, mercY) {
var rMajor = 6378137; //Equatorial Radius, WGS84
var shift = Math.PI * rMajor;
var lon = mercX / shift * 180.0;
var lat = mercY / shift * 180.0;
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0);
return { 'Lon': lon, 'Lat': lat };
}