This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "logger" | |
log = Logger.new(STDOUT) | |
log.level = Logger::WARN | |
critical = Logger.new(STDERR) | |
log.debug("Created logger") | |
log.info("Program started") | |
log.warn("Nothing to do!") | |
critical.error("Critical error!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require "../../spec_helper" | |
require "spec" | |
describe "Semantic: pointer" do | |
it "types int pointer" do | |
# assert_type("a = 1; pointerof(a)") { pointer_of(int32) } | |
(a = 1; pointerof(a)).class.should eq(Pointer(Int32)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "db" | |
require "sqlite3" | |
require "benchmark" | |
QUERY = "select id from numbers" | |
DB.open "sqlite3:./file.db" do |db| | |
db.exec %q{DROP TABLE `numbers`} | |
end | |
DB.open "sqlite3:./file.db" do |db| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "libao" | |
include Libao | |
# Simple Command Line Audio Player with VU-meter in Crystal (0.25.0) | |
# Requires ffmpeg and libao-dev | |
# dependencies: | |
# shard dependency: github.com/mjago/libao | |
# Tested on mp3, flac, and m4a files | |
class Converter | |
PIPE = Process::Redirect::Pipe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Firs look at node visualisation | |
This is top-down but can be changed to left-to-right with some fiddling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "../src/sdl" | |
require "../src/mixer" | |
SDL.init(SDL::Init::VIDEO | SDL::Init::AUDIO); at_exit { SDL.quit } | |
SDL::Mixer.init(SDL::Mixer::Init::MP3); at_exit { SDL::Mixer.quit } | |
SDL::Mixer.open | |
chunk = {} of String => LibMixer::Mix_Chunk* | |
names = %w(high medium low scratch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib SomeLib | |
fun some_fun(LibC::Char*) | |
end | |
class SomeClass | |
def some_fun(arg : String) | |
SomeLib.some_fun(arg) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u /Users/martyn/.cache/crystal/initial_build/ /Users/martyn/.cache/crystal/Users-martyn-crystal-compile-empty.cr/ | |
Binary files /Users/martyn/.cache/crystal/initial_build/H-ash40T-hread4432N-il41.bc and /Users/martyn/.cache/crystal/Users-martyn-crystal-compile-empty.cr/H-ash40T-hread4432N-il41.bc differ | |
Binary files /Users/martyn/.cache/crystal/initial_build/S-et40T-hread41.bc and /Users/martyn/.cache/crystal/Users-martyn-crystal-compile-empty.cr/S-et40T-hread41.bc differ | |
Binary files /Users/martyn/.cache/crystal/initial_build/T-hread.bc and /Users/martyn/.cache/crystal/Users-martyn-crystal-compile-empty.cr/T-hread.bc differ | |
* Initial Build: | |
** H-ash40T-hread4432N-il41.bc | |
debug info... | |
Hash(Thread, Nil).CrystalDebug Info Versionhash.cr/usr/local/Cellar/crystal-lang/HEAD-102be34_2/srcint | |
initialize:initial_capacity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
llvm-config 3.9.1 | |
Crystal 0.20.5+27 [03e69b7] (2017-01-31) | |
clang version 3.9.1 (tags/RELEASE_391/final) | |
Tue Jan 31: > ./bin/crystal spec spec/compiler_spec.cr | |
Using compiled compiler at .build/crystal | |
ld: warning: unknown dwarf DW_FORM_strp (offset=0x00000080) is too big in E-xception.o | |
ld: warning: unknown dwarf DW_FORM_strp (offset=0x00000080) is too big in H-ash40T-hread4432N-il41.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
non release compiler: | |
Wed Jan 25: compile/ > bin/crystal ../examples/hello/hello.cr -- | |
release --stats | |
Using compiled compiler at .build/crystal | |
Parse: 00:00:00.0409620 ( 0.19MB) | |
Semantic (top level): 00:00:00.5428400 ( 26.57MB) | |
Semantic (new): 00:00:00.0078450 ( 26.57MB) | |
Semantic (type declarations): 00:00:00.0535600 ( 26.57MB) | |
Semantic (abstract def check): 00:00:00.0026690 ( 26.57MB) | |
Semantic (cvars initializers): 00:00:00.0243660 ( 34.57MB) |
NewerOlder