Skip to content

Instantly share code, notes, and snippets.

View tekkub's full-sized avatar

Tekkub tekkub

View GitHub Profile
SecondsToTimeAbbrev = function(time)
if time <= 0 then return ""
elseif time < 3600 then
local m, s = floor(time / 60), mod(time, 60)
return (m == 0 and format("%d", s)) or format("%d:%02d", m, s)
else
local hr, m = floor(time / 3600), floor(mod(time, 3600) / 60)
return format("%d:%02d", hr, m)
end
end
# data = {:method_vendors=>[{:price=>[8000, 0, 0], :type=>7, :locs=>[440], :react=>[1, 1],
# :desc=>"Alchemy Supplies", :name=>"Alchemist Pestlezugg", :minlevel=>45, :id=>5594}],
# :learned=>200, :produces=>[3577], :skillup=>[200, 240, 260, 280], :method_drops=>[],
# :rarity=>2, :method=>"sold-by,", :reagents=>[[3575, 1]], :id=>9304}
# Assuming the containing structure is an array...
new_data = bigger_struct.map do |data|
source, trainerflag = "Unknown", "nil"
@tekkub
tekkub / gist:9069
Created September 6, 2008 02:04
Using the subtree merge to join two repos, but maintain their history
For more details:
http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
gitk --all output:
http://www.flickr.com/photos/26681170@N03/2831381183/
local mypatch, mybuild = "3.0.2", "8905"
local version, build = GetBuildInfo()
if version ~= mypatch or build ~= mybuild then
return ChatFrame1:AddMessage("|cFF33FF99ChatLinkFix|r: This addon is only designed to work with patch "..mypatch.." build "..mybuild..
". If the bug is not fixed, please check for an updated version.")
end
local orig = ChatFrame_OnHyperlinkShow
@tekkub
tekkub / tagger.lua
Created September 14, 2008 01:47
Fuck LibDogTag
local function UnitName(unit)
return "Joe"
end
local tags = {
name = UnitName,
blank = function() return "" end,
}
Interface\AddOns\oUF\elements\castbar.lua:227: attempt to index global 'self' (a nil value)
[C]: ?
Interface\AddOns\oUF\elements\castbar.lua:227: in function `func'
Interface\AddOns\oUF\ouf.lua:224: in function <Interface\AddOns\oUF\ouf.lua:190>
Interface\AddOns\oUF\ouf.lua:291: in function `Spawn'
Interface\AddOns\oUF_tek\layout.lua:403: in main chunk
-- Info string
local info = pp:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
info:SetPoint("LEFT", 2, 0)
info:SetPoint("RIGHT", ppp, "LEFT", -2, 0)
info:SetJustifyH"LEFT"
info:SetTextColor(1, 1, 1)
info:SetText("[difficulty][smartlevel] [rare] [raidcolor][smartclass]")
table.insert(self.TaggedStrings, info)
@tekkub
tekkub / subtree_merge.sh
Created September 15, 2008 23:36
Bash script for working with git subtree merge
#! /bin/bash
# Based off of http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
if [[ ! "$2" || ("$3" && ! "$4" ) ]]
then
filename=`echo "$0"| sed "s/.*\///"`
echo "Usage: $filename remote_name repo_url branch_name path_to_merge_to"
echo " * Create a new subtree merge"
echo " $filename remote_name branch_name"
echo " * Pull from remote_name/branch_name into subtree"
----------- AddOns/Blizzard_AchievementUI/Blizzard_AchievementUI.lua -----------
index 7322f41..7326bc3 100644
@@ -1,9 +1,9 @@
-local desaturateSupported = IsDesaturateSupported();
-
UIPanelWindows["AchievementFrame"] = { area = "doublewide", pushable = 0, width = 840, xoffset = 80, whileDead = 1 };
ACHIEVEMENTUI_CATEGORIES = {};
+fubar = true
Capslock::
if WinExist("ahk_class Chrome_XPFrame")
{
WinActivate
WinWaitActive
Send, ^t
}
else
{
EnvGet, USERPROFILE, USERPROFILE