Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
AJFaraday / gist:6259032
Created August 17, 2013 22:36
As sad as it is, this test is, for the time being, my pride and joy
andrew@andrew-laptop:~/RubyPG$ ruby test/unit/battle_test.rb
Loaded suite test/unit/battle_test
Started
player turn
[["Attack", 1]]
[["snail", 2]]
player uses Attack on snail
Damage: health -1
enemy turn
[["Spit", 3], ["Attack", 4]]
andrew@andrew-laptop:~/RubyPG$ ruby test/unit/skill_effect_test.rb
*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`.
*** Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
*** Mocha deprecation warning: If you're integrating with a test library other than Test::Unit or MiniTest, you should use `require 'mocha/api'` instead of `require 'mocha'`.
user: bizzlejawline
source: <a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>
country: United Kingdom
place: Guildford
lat: 51.25120404
long: -0.57254453
[bizzlejawline] @justinbieber how r u today ?
@AJFaraday
AJFaraday / gist:9951279
Created April 3, 2014 09:25
debugging methodology
if x
...
elsif y
...
else
puts "You screwed up."
end
@AJFaraday
AJFaraday / gist:2ee07be60ac7af5f7a6c
Created May 11, 2014 16:42
Failed make install for pure data on SUSE
pdlua.c:244:16: warning: unused parameter ‘L’ [-Wunused-parameter]
lua_State *L, /**< Lua interpreter state. */
^
pdlua.c: In function ‘pdlua_popatomtable’:
pdlua.c:1059:9: warning: implicit declaration of function ‘lua_objlen’ [-Wimplicit-function-declaration]
*count = lua_objlen(L, -1);
^
pdlua.c: In function ‘pdlua_dofile’:
pdlua.c:1558:17: error: too few arguments to function ‘lua_load’
if (lua_load(L, pdlua_reader, &reader, filename))
@AJFaraday
AJFaraday / gist:c9adb7db47eca8230246
Created May 11, 2014 22:47
failed make install for pure data post 5.2 changes...
make -C /home/biorails/Downloads/pd-extended/externals/loaders/pdlua/src PD_PATH=/home/biorails/Downloads/pd-extended/pd CFLAGS="-DPD -DHAVE_G_CANVAS_H -DZEXY_LIBRARY -I/home/biorails/Downloads/pd-extended/pd/src -Wall -W -ggdb -I/home/biorails/Downloads/pd-extended/externals/Gem -I/home/biorails/Downloads/pd-extended/externals/pdp/include -DUNIX -Dunix -DDL_OPEN -fPIC"
make[3]: Entering directory `/home/biorails/Downloads/pd-extended/externals/loaders/pdlua/src'
compiling pdlua version 0.6
cflags are -DPD -DHAVE_G_CANVAS_H -DZEXY_LIBRARY -I/home/biorails/Downloads/pd-extended/pd/src -Wall -W -ggdb -I/home/biorails/Downloads/pd-extended/externals/Gem -I/home/biorails/Downloads/pd-extended/externals/pdp/include -DUNIX -Dunix -DDL_OPEN -fPIC
optcflags are -O3 -funroll-loops -march=k8 -msse -msse2 -msse3 -mfpmath=sse -ftree-vectorize -ftree-vectorizer-verbose=1
luacflags are -DVERSION='0.6' -I/usr/include/lua
ldflags are -Wl,--export-dynamic -shared -fPIC
libs are -llua -lc
cc -DPD -DHAVE_G_CANVAS_H -DZEXY_
@AJFaraday
AJFaraday / gist:97b9288919ab7f6dfd15
Created May 13, 2014 21:51
Generate green-red fade classes in ruby for SCSS
i = 0
r = 0.0
g = 255.0
101.times do
puts <<-TEXT
.heat-map-#{i} {
@AJFaraday
AJFaraday / gist:18fc83b96b153ce2b3e9
Last active August 29, 2015 14:01
Pure Data audio issues
ajfaraday@scaled-up:/opt/scaled_up$ pd-extended -open pd/test-tones.pd -alsa -listdev -nogui
audio input devices:
1. HDA NVidia (hardware)
2. HDA NVidia (plug-in)
audio output devices:
1. HDA NVidia (hardware)
2. HDA NVidia (plug-in)
API number 1
no midi input devices found
order_table = Order.arel_table
arel = Order.where(order_table[:id].not_in([]))
sql = arel.to_sql
puts sql
#=> SELECT "ORDERS".* FROM "ORDERS" WHERE ("ORDERS"."ID" NOT IN (NULL))
@AJFaraday
AJFaraday / gist:8003815a243575eb06ac
Created July 16, 2014 09:56
Possible ruby bug (1.9.3) else without an if is ignored...
def test_method
@var = 'a'
else
@var = 'b'
end
test_method
@var #=> 'b'