Skip to content

Instantly share code, notes, and snippets.

View gutenye's full-sized avatar
:octocat:
Guten tag!

Guten gutenye

:octocat:
Guten tag!
View GitHub Profile
@gutenye
gutenye / gist:882616
Created March 23, 2011 04:25
write bundler into .gemspec file instead of using 'gemspec'
# a.gemspec
require "bundler"
Gem::Specification.new do |s|
s.name = "hello"
....
s.add_bundler_dependencies
end
@gutenye
gutenye / gist:1108486
Created July 27, 2011 01:38
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
@gutenye
gutenye / gist:1300152
Created October 20, 2011 01:12
disable suite and test in RSpec
# put this in spec_helper.rb
module Kernel
private
def xdescribe(*args, &blk)
describe *args do
pending "xxxxxxxxx"
end
end
(process:9963): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
(qq:9963): GdkPixbuf-CRITICAL **: gdk_pixbuf_add_alpha: assertion `GDK_IS_PIXBUF (pixbuf)' failed
(qq:9963): GdkPixbuf-CRITICAL **: gdk_pixbuf_copy_area: assertion `src_pixbuf != NULL' failed
(qq:9963): GdkPixbuf-CRITICAL **: gdk_pixbuf_copy_area: assertion `src_pixbuf != NULL' failed
(qq:9963): GdkPixbuf-CRITICAL **: gdk_pixbuf_copy_area: assertion `src_pixbuf != NULL' failed
@gutenye
gutenye / download-progress.rb
Created December 31, 2011 04:47 — forked from Burgestrand/download-progress.rb
Ruby HTTP file download with progress measurement
require 'net/http'
def download(url)
Thread.new do
thread = Thread.current
thread[:body] = []
thread[:done] = 0
url = URI(url)
Net::HTTP.new(url.host, url.port).get2(url.path) do |res|
@gutenye
gutenye / PKGBUILD
Created February 25, 2012 02:13
PKGBUILD
# just because AUR upload doesn't like ".pkg.tar.xz"
#PKGEXT=".pkg.tar.gz"
pkgname=gptsync
pkgver=0.14
pkgrel=2
pkgdesc="gptsync is a utility to maintain an MBR partition table synchronised with a GPT partition table used as reference. The resulting MBR partition table can contain up to 4 partitions; extended partitions are not supported."
arch=('i686' 'x86_64')
url=('http://packages.debian.org/sid/gptsync')
license=('custom')
@gutenye
gutenye / gist:2774210
Created May 23, 2012 09:27
ruby c extension example
# gem install ffi
require "ffi"
module Libc
extend FFI::Library
ffi_lib 'c'
attach_function "printf", [:string, :varargs], :int
end
@gutenye
gutenye / gist:3145326
Created July 19, 2012 17:02
三国杀-马腾
module("extensions.mateng", package.seeall)
extension = sgs.Package("mateng")
mateng = sgs.General(extension, "mateng", "qun", "4", true)
mtmashu = sgs.CreateDistanceSkill{
name = "mtmashu",
correct_func = function(self, from, to)
if from:hasSkill("mtmashu") then
@gutenye
gutenye / gist:3154220
Created July 21, 2012 01:50
神杀-迷当.lua
module("extensions.midang", package.seeall)
extension = sgs.Package("midang")
midang = sgs.General(extension, "midang", "qun", "4", true)
--借兵:出牌阶段,你可以指定另一角色装备区里的一张牌并弃一张与之相同花色的手牌,令目标角色对你攻击范围内一名角色(可以是你)使用一张杀,否则交给你这张装备牌。每回合限一次。
-- TODO: 少SkilCard#target_assigned Lua接口.
-- ViewAsSkill => jiebing_card
-- SkillCard
#0 0x00007fd3ea5acab0 in QString::startsWith(QChar const&, Qt::CaseSensitivity) const () from /lib/libQtCore.so.4
#1 0x0000000000466b5b in Player::setFlags(QString const&) ()
#2 0x000000000044102e in ClientPlayer::setFlags(QString const&) ()
#3 0x0000000000649b13 in RoomScene::handleGameEvent(Json::Value const&) ()
#4 0x000000000075741e in RoomScene::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
#5 0x00007fd3ea676f3f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /lib/libQtCore.so.4
#6 0x0000000000727d03 in Client::event_received(Json::Value const&) ()
#7 0x000000000043e6f8 in Client::processServerPacket(char const*) ()
#8 0x0000000000728581 in Client::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
#9 0x00007fd3ea676f3f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /lib/libQtCore.so.4