Skip to content

Instantly share code, notes, and snippets.

@jotbe
jotbe / jq_ajax.js
Created September 12, 2011 08:44
jQuery Ajax
function callAjax(u, d, t) {
jQuery.ajax({
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
dataType: "html",
type: "POST",
url: u,
data: d,
success: function(msg) {
if(t) {
if(t === ':eval') {
@jotbe
jotbe / check-remote-file-change.py
Created July 24, 2011 20:25
Check for remote file changes
#!/usr/bin/env python
"""This script checks the Last-Modified header of a remote file.
It will use Growl to notify the user, when the field differs from a specified comparison time.
"""
__author__ = 'Jan Beilicke'
__date__ = '2011-07-24'
import sys
@jotbe
jotbe / getSqlDate.sql
Created July 6, 2011 10:35
MySQL: Get formatted ISO date from string with european date (can be easily extended to other formats)
/**
* This script has been tested in MySQL 5.1.37.
* It might work with other SQL-DBMS as well.
*/
DROP FUNCTION IF EXISTS getSqlDate;
DELIMITER //
CREATE FUNCTION getSqlDate(str VARCHAR(10))
RETURNS VARCHAR(10) DETERMINISTIC
CASE
@jotbe
jotbe / function_return_case_short_form.sql
Created July 6, 2011 10:12
SQL function that returns CASE results in a short form
/**
* This sample demonstrates how to return the results
* of a CASE statement in a short way without wrapping
* it into BEGIN/END, declaring and setting variables
* and returning the result at the end.
*
* Author: Jan Beilicke <dev@jotbe-fx.de>
* Date: 2011-07-06
*/
DROP FUNCTION IF EXISTS caseTestShort;