Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@HarpyWar
HarpyWar / gameplayers
Last active August 29, 2015 13:57
MySQL trigger for Ghost table 'gameplayers' and PvPGN table 'pvpgn_bnet'. It adds leave count for players.
/* Increase acct_leave count +1 when new ROW inserted into table `gameplayers`, if player left time less then game duration -5 munutes */
DELIMITER $$
CREATE
TRIGGER `leaver_trigger` BEFORE INSERT
ON `gameplayers`
FOR EACH ROW BEGIN
IF ( NEW.left < (SELECT duration FROM games WHERE games.id = NEW.gameid) - 60*5 ) THEN
UPDATE pvpgn_bnet SET pvpgn_bnet.acct_leave = pvpgn_bnet.acct_leave + 1 WHERE LOWER(NEW.name) = LOWER(pvpgn_bnet.username);
END IF;
bbcodeParser.htmlToBBCode doesn't work with complex tags.
For instance:
bbcodeParser.addBBCode('[quote={TEXT1}]{TEXT2}[/quote]', '<div class=quote><cite>{TEXT1}</cite><p>{TEXT2}</p></div>');
var bbcode = bbcodeParser.htmlToBBCode('<div class=quote><cite>Author</cite><p>My message</p></div>');
It returns the same HTML string, but not BB code string.
@HarpyWar
HarpyWar / clan.c
Created October 18, 2012 15:30
Clan tag is case-sensitive in 1.8.5 and case-insensitive in 1.99
extern t_clan *clanlist_find_clan_by_clantag(int clantag)
{
t_elem *curr;
t_clan *clan;
if (clantag == 0)
return NULL;
if (clanlist_head)
{
LIST_TRAVERSE(clanlist_head, curr)
@HarpyWar
HarpyWar / Murmur.cs
Created May 19, 2017 18:49
Murmur.ice 1.3.0 autogenerated slice for C#
This file has been truncated, but you can view the full file.
// **********************************************************************
//
// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// Ice version 3.4.2
@HarpyWar
HarpyWar / sock.c
Last active January 10, 2024 08:41
wine-2.0.1/server/sock.c for D2GS
/*
* Server-side socket management
*
* Copyright (C) 1999 Marcus Meissner, Ove Kåven
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*