Skip to content

Instantly share code, notes, and snippets.

View endel's full-sized avatar

Endel Dreyer endel

View GitHub Profile
@endel
endel / Magento: Retorno de pagamento do PagSeguro
Created April 7, 2010 21:27
Retorno do PagSeguro customizado. Veja o módulo completo em: http://visie.com.br/pagseguro/plataforma/magento/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@endel
endel / gist:434481
Created June 11, 2010 13:39
J2ME Bitmap Font Class
package com.stonespells.core;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
public class Font {
// additional space between characters
public int charS = 0;
// max clipping area
require 'ar-extensions'
# ActiveRecord::Extensions fix for using ILIKE with PostgreSQL database
#
# Usage sample:
# User.find(:all, :conditions { :name_ilike => "%something%" })
module ActiveRecord::Extensions
class ILike
# __ <`-,-,_,-,
# \_;> ^ _<---'
# ) _,-'
# / /
# __ ,' /
# )_\ _,-' /
# \_ _,-_-,_ _,-' /
# \_/\,_ ` `' \
# /\,_ ` |
# |\,_` ) , <
##
# test/spec/mini 3
# http://gist.github.com/25455
# chris@ozmm.org
# file:lib/test/spec/mini.rb
#
def context(*args, &block)
return super unless (name = args.first) && block
require 'test/unit'
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do
@endel
endel / remove_duplicates.sql
Created May 17, 2011 03:06
Remove duplicate entries from MySQL table.
DELETE FROM table1
USING table1,
table1 as table2
WHERE table2.id > table1.id
AND table2.unique_param = table1.unique_param
// This code was written by Tyler Akins and has been placed in the
// public domain. It would be nice if you left this header intact.
// Base64 code from Tyler Akins -- http://rumkin.com
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function encode64(input) {
var output = new StringMaker();
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
@endel
endel / auto_link.rb
Created June 9, 2011 02:07
Helper to fill twitter texts with links.
@endel
endel / auto_link.js
Created June 9, 2011 02:24
Helper to fill twitter texts with links.
@endel
endel / gist:1028045
Created June 15, 2011 20:38
Gracefully quit all Resque workers.
require 'resque'
Resque.workers.each{|worker| system("kill -QUIT #{worker.pid}") }