Skip to content

Instantly share code, notes, and snippets.

View pgaertig's full-sized avatar

Piotr Gaertig pgaertig

View GitHub Profile
@pgaertig
pgaertig / TopLogger.js
Last active August 29, 2015 14:01
Records log messages and sends report to server in case of any error or warning.
function TopLogger(url, sessionId) {
var self = this;
var sid = sessionId;
var counter = 0;
var entries = [];
function consoleLog(type, msg) {
if(consoleChain && consoleChain[type]) {
try {
@pgaertig
pgaertig / FactoryGrill.groovy
Last active June 15, 2019 04:09
FactoryGrill - db population made easy - a-la FactoryGirl
import groovy.sql.Sql
import org.codehaus.groovy.control.CompilerConfiguration
import java.sql.Connection
class FactoryGrill extends Script {
private Connection connection;
private Sql sql;
@pgaertig
pgaertig / base64shim.js
Created September 14, 2013 22:12
Base64 (btoa/atob) shim adapted for WebKit's Web Workers, which miss these functions. See https://bugs.webkit.org/show_bug.cgi?id=55663
// Source: http://code.google.com/p/gflot/source/browse/trunk/flot/base64.js?r=153
/* Copyright (C) 1999 Masanao Izumo <[email protected]>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
/*
* Interfaces:
@pgaertig
pgaertig / development.rb
Created December 2, 2012 22:36
Dogslow like functionality for Rack and Rails
#Add this to your development.rb
config.middleware.use DogslowRack
@pgaertig
pgaertig / transpose_table.js
Created April 13, 2012 13:48
Transpose HTML table using jQuery
$(function() {
var t = $('#thetable tbody').eq(0);
var r = t.find('tr');
var cols= r.length;
var rows= r.eq(0).find('td').length;
var cell, next, tem, i = 0;
var tb= $('<tbody></tbody>');
while(i<rows){
cell= 0;
@pgaertig
pgaertig / example.rb
Created April 12, 2012 10:27
JsonCommand
def destroy
#...
flash[:success] = t("entity_name.delete.success", :name => entity.name)
respond_to do |format|
format.html do
redirect_to :action=>:index
end
format.json { render :json => {
'delete-row'=>dom_id(entity)),
'flash-success' => flash.discard[:success]} }