Skip to content

Instantly share code, notes, and snippets.

View tiesmaster's full-sized avatar

Thijs Brobbel tiesmaster

View GitHub Profile
@tiesmaster
tiesmaster / build_magik_image-no_notify_caller-workaround.magik
Created July 6, 2011 11:27
build_magik_image() doesn't notify its caller on a failing load_code_proc()
_block
_global build_failed
build_failed << _false
magik_image.register_new("test",
:image_file_name, "test",
:load_modules, :non_existing_module,
:load_code_proc,
_proc(mi)
_try
@tiesmaster
tiesmaster / .gitignore
Created July 23, 2011 17:34
PrintStdIn
# https://raw.github.com/github/gitignore/master/Global/vim.gitignore
.*.sw[a-z]
*.un~
Session.vim
# binaries
*.exe
*.dll
@tiesmaster
tiesmaster / get_user_default_locale.c
Created September 28, 2011 12:53
Retrieve the default user locale on Windows
#include <windows.h>
#include <stdio.h>
void main() {
char locale_name[32];
if (GetLocaleInfo (LOCALE_USER_DEFAULT,
LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
locale_name, sizeof (locale_name)))
{
printf("%s\n", locale_name);
remex(:export_internal_world_substation_union_lane_as_png)
$
@export_internal_world_substation_union_lane_as_png.delete()
$
def_slotted_exemplar(:export_internal_world_substation_union_lane_as_png, {})
$
_method export_internal_world_substation_union_lane_as_png.write_png
@tiesmaster
tiesmaster / transfer.magik
Created September 27, 2012 06:47
Do a ds_transfer using source concurrency mode on :singleuser
_block
sw_module_manager.load_module(:ds_transfer)
_endblock
$
_block
ds_environment.concurrency_mode << :singleuser
ds_environment.init()
_endblock
$
@tiesmaster
tiesmaster / example_of_alias_stream_usage.magik
Created October 11, 2012 12:52
Explanation of alias_stream...
_block
_local st_which_changes_like_output << alias_stream.new_on(@!output!)
_local write_hoi <<
_proc @write_hoi(st)
st.write("hoi")
st.newline()
_endproc
_local call_proc_with_dynamic_changed_and_callback <<
_proc @call_proc_with_dynamic_changed_and_callback(callback, st)
_dynamic !output! << internal_text_output_stream.new()
@tiesmaster
tiesmaster / git_adds_magikc_files_for_missing_magik_files.sh
Created October 15, 2012 10:32
Adds magikc files for missing *.magik files.
find . -name '*.magikc' -type f -exec sh -c '[ ! -f `file={}; echo ${file%c}` ] && git add -f {}' \; |head
@tiesmaster
tiesmaster / get_namelan_table.magik
Created November 28, 2012 11:38
Get namelan table
namelan << ds_collection.cold_start(gv.file("rwo.ds"), :ds!namelan, 0, gv.namelan_table)
@tiesmaster
tiesmaster / quine.magik
Created December 2, 2012 11:16
Magik Quine
_block
_local quote_char << character.from_value(34)
_local s << {
"_block",
" _local quote_char << character.from_value(34)",
" _local s << {",
" }",
" _for line _over s.slice(1, 3).fast_elements()",
" _loop",
" write(line)",
@tiesmaster
tiesmaster / crash.magik
Created December 4, 2012 16:03
Crash the GIS
_block
# results in a failed assertion
_thisthread.sys!slot(:vm_dynamic_environment) <<
_thisthread.vm_dynamic_environment.sys!augment_dynamic_environment(@!hoi!, :dag)
_endblock
$
_block
# results in an access violation
terminal.method(:put_charvec|()|).value.sys!perform(:at0|()<<|, 0, 0)