Skip to content

Instantly share code, notes, and snippets.

@mabako
mabako / decode.lua
Created June 28, 2012 18:37
lua € thing, unicode(like utf16)->utf8
:gsub("&#%d%d%d%d;", decode)
function decode(str)
local num = tonumber(str:sub(3,6))
local first = math.floor(num/4096)
num = num - 4096 * first
return string.char(first+224, math.floor(num/64)+128, num%64+128)
end
@mabako
mabako / UserTable.java
Created June 15, 2012 12:48
User management in SQL Server 2008 R2
package net.mabako.zwickau.db;
import static net.mabako.zwickau.autohaendler.G.db;
import java.util.Vector;
public class UserTable extends TableHandler
{
/**
* {@inheritDoc}
@mabako
mabako / Dashboard.java
Created May 29, 2012 19:51
TableView thing for databases
package net.mabako.zwickau.autohaendler;
import javax.swing.JButton;
public class Dashboard extends JPanel
{
/**
* Serial
*/
private static final long serialVersionUID = -2754350246072768836L;
@mabako
mabako / PrintExample.java
Created May 29, 2012 18:45
Simple way to print Java GUI elements
// beliebige Komponente
final Component component = ...;
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(new Printable()
{
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
local function isYearALeapYear(year)
if not year then
year = getRealTime().year + 1900
end
if (year % 4 == 0 and year % 100 ~= 0) or year % 400 == 0 then
return true
else
return false
end
end
@mabako
mabako / stats.php
Created May 12, 2010 04:31
Statistics for valhallaGaming repos
mabako: 553814 (44.65%) lines, 3549 (54.38%) files
Mount: 363479 (29.31%) lines, 1172 (17.96%) files
Fenix: 240925 (19.43%) lines, 1463 (22.42%) files
Chamberlain: 51597 (4.16%) lines, 298 (4.57%) files
herbjr: 13238 (1.07%) lines, 18 (0.28%) files
Cazomino05: 5826 (0.47%) lines, 0 (0%) files
Flobu: 4733 (0.38%) lines, 10 (0.15%) files
VGMTAServer: 1751 (0.14%) lines, 1 (0.02%) files
Mr.Hankey: 1709 (0.14%) lines, 0 (0%) files
Jumba: 1187 (0.1%) lines, 3 (0.05%) files