Skip to content

Instantly share code, notes, and snippets.

View kimmellj's full-sized avatar

James Kimmell kimmellj

View GitHub Profile
@kimmellj
kimmellj / scroll_test
Created October 4, 2012 02:18
scroll test
<html>
<head>
<title></title>
<style type="text/css">
div.special {
border: 2px solid #FFCCCC;
width: 200px;
height: 400px;
position: absolute;
@kimmellj
kimmellj / MySQL_distance_function.sql
Created October 18, 2012 17:25
This is a MySQL function that will calculate the distance between two latitude and longitude points
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`foobar`@`localhost`*/ /*!50003 FUNCTION `distance`( lat1 DOUBLE, lon1 DOUBLE, lat2 DOUBLE, lon2 DOUBLE ) RETURNS DOUBLE
DETERMINISTIC
BEGIN
RETURN 3956 * 2 * ASIN(SQRT(POWER(SIN((lat1 - lat2) * pi()/180 / 2), 2) + COS(lat1 * pi()/180) * COS(lat2 * pi()/180) * POWER(SIN((lon1 - lon2) * pi()/180 / 2), 2)));
END */;;
#!/bin/bash
# sonia 16-nov-05
# backup each mysql db into a different file, rather than one big file
# as with --all-databases - will make restores easier
OUTPUTDIR="/root/db_backups-2013-06-27"
MYSQLDUMP="/usr/bin/mysqldump"
MYSQL="/usr/bin/mysql"
# clean up any old backups - save space
@kimmellj
kimmellj / demand-ware-web-tail
Last active December 21, 2015 20:09
Demand Ware Web Tail
#!/bin/bash
POLLING_INTERVAL=2
CONTENT_LENGTH=0
URL=$1
USER=$2
PASS=$3
if [ -z "$URL" ]
@kimmellj
kimmellj / bootstrap_links.php
Created September 20, 2013 19:11
Pagination links for CakePHP while using Twitter's Bootstrap
@kimmellj
kimmellj / pipe-line-name-parser.js
Created September 8, 2014 17:58
Demandware Pipeline Name Parser
/**
* Parse out the Pipelines created in a Demandware Pipeline File
*
* This script requires the node-xml2js library, npm install npm install xml2js
*
* To call: node index.js /some/path/to/the/desired/file/pipelines.xml
*
* @param File Name, the first and only argument to this script is a path to the file to parse
*/
@kimmellj
kimmellj / dw_cp.rb
Last active August 29, 2015 14:16
SiteGenesis Copy Command
#!/usr/bin/ruby
# Parameters for doing the copy
#destCart = ARGV[0]
#baseFile = ARGV[1]
destCart = "./cartridges/some_cartridge"
baseFile = ARGV[0]
# Get the index of the cartridge directory so we can replace the begining
# with our desitnation cartridge
@kimmellj
kimmellj / Configuration.java
Last active September 28, 2022 20:06
Configuration Singleton Example - Java
package nettail;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;
@kimmellj
kimmellj / configuration.js
Created March 18, 2015 19:04
Configuration Singleton Example - JavaScript
/**
* http://robdodson.me/javascript-design-patterns-singleton/
* http://addyosmani.com/resources/essentialjsdesignpatterns/book/#singletonpatternjavascript
*/
var Configuration = (function () {
// Instance stores a reference to the Singleton
var instance;