Skip to content

Instantly share code, notes, and snippets.

View hakanai's full-sized avatar
⚔️
Battling i16n demons

Hakanai hakanai

⚔️
Battling i16n demons
View GitHub Profile
@hakanai
hakanai / gist:1373180
Created November 17, 2011 13:51
idolmaster 2 sales formula
sales = ((total purchasing power) / 2 + (highest score for song) * 4)
* sales bonus
* sales factor
* marketing factor
purchasing power of a region = fan count * attention ratio
attention ratio:
red (5.5 ~ 6.5): 0.95
amber (3.5 ~ 5.0): 0.90 (fans down 2% per week)
-- Returns the right number of results but the licences returned are the earliest
-- for each dongle instead of the latest (what Rails generates without tinkering):
SELECT `licences`.* FROM `licences`
INNER JOIN `dongles` ON `dongles`.id = `licences`.dongle_id
WHERE (`dongles`.`organisation_id` = 1070)
AND ((`licences`.`parent_licence_id` IS NULL))
GROUP BY dongles.id
ORDER BY dongles.name ASC, licences.created_at DESC
@hakanai
hakanai / output
Created July 9, 2012 03:24
Does minitest autorun not actually work?
C:\Data\Projects\acme\trunk\product\functional-tests>ant
Buildfile: C:\Data\Projects\acme\trunk\product\functional-tests\build.xml
-init:
functional-tests-x86:
[java] defined test class TestTrivial
BUILD SUCCESSFUL
Total time: 1 minute 4 seconds
@hakanai
hakanai / log
Created August 30, 2012 04:20
Ever wonder what svn does if someone has committed a virus and then you check it out while running a virus scanner? Well now you know!
A test-data\executable\packed.exe
svn: E720005: Can't open file 'C:\Data\Projects\acme\trunk\.svn\pristine\3c\3c560c0fd84ffd63f2ebd1720c4901f4203faed0.svn-base': Access is denied.
C:\Data\Projects\acme\trunk\product>svn up
svn: E155037: Previous operation has not finished; run 'cleanup' if it was interrupted
C:\Data\Projects\acme\trunk\product>svn cleanup
svn: E155004: Working copy 'C:\Data\Projects\acme\trunk\product' locked.
svn: E155004: 'C:\Data\Projects\acme\trunk' is already locked.
svn: E155037: Previous operation has not finished; run 'cleanup' if it was interrupted
@hakanai
hakanai / test
Created September 29, 2012 02:23
wtf bundler?
require 'rubygems'
require 'bundler/setup' # Without this line, everything works. With it, segfault.
require 'blather/client/client'
class XMPP
def initialize
@client = Blather::Client.setup('zing@example.com', 'password')
@client.register_handler(:ready) do
puts "Connected to XMPP"
end
@hakanai
hakanai / waffle.log
Created October 12, 2012 02:20
WAFFLE prompts for a password but then logs in even if you cancel.
2012-10-11 20:56:26,904 [Service-1] 10655 DEBUG waffle.servlet.NegotiateSecurityFilter - [waffle.servlet.NegotiateSecurityFilter] loaded
2012-10-11 20:56:26,904 [Service-1] 10655 DEBUG waffle.servlet.NegotiateSecurityFilter - waffle.servlet.spi.BasicSecurityFilterProvider/realm=App
2012-10-11 20:56:26,904 [Service-1] 10655 DEBUG waffle.servlet.NegotiateSecurityFilter - initializing default security filter providers
2012-10-11 20:56:26,904 [Service-1] 10655 DEBUG waffle.servlet.NegotiateSecurityFilter - setting waffle.servlet.spi.BasicSecurityFilterProvider, realm=App
2012-10-11 20:56:26,904 [Service-1] 10655 INFO waffle.servlet.NegotiateSecurityFilter - [waffle.servlet.NegotiateSecurityFilter] started
2012-10-11 20:57:47,167 [qtp1407420403-70 - /api/call] 90918 DEBUG waffle.servlet.NegotiateSecurityFilter - POST /api/call, contentlength: 22
2012-10-11 20:57:47,167 [qtp1407420403-70 - /api/call] 90918 DEBUG waffle.servlet.NegotiateSecurityFilter - authorization required
class Example < Chatcraft::Plugins::Base
metadata :name => 'example',
:version => '0.0.1',
:author => 'John Smith <smithy@example.com>'
on :group_message, ['hi', :target], :call => :hi
def hi(user, group, message, params)
if params[:target] == group.client.bot_name
group.say "hi, #{user}"
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.net.URL;
import com.lowagie.text.BadElementException;
import com.lowagie.text.Image;
import com.lowagie.text.ImgTemplate;
import com.lowagie.text.pdf.PdfContentByte;
@hakanai
hakanai / FakeJDialog.java
Created November 29, 2012 02:57
Swing, you shithead, stop flickering!
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Window;
import javax.swing.JLayeredPane;
import javax.swing.JRootPane;
import javax.swing.RootPaneContainer;
/**
@hakanai
hakanai / gist:4173501
Created November 30, 2012 02:52
Why natural language is a bitch
import org.junit.Test;
import static org.junit.Assert.*;
public class TestEvilNaturalLanguageStuff
{
@Test
public void testToUpperCaseAndToLowerCaseAreNoSubstituteForEqualsIgnoreCase()
{
String str1 = "Vikipedi";
String str2 = "V\u0130K\u0130PED\u0130";