Skip to content

Instantly share code, notes, and snippets.

View hernad's full-sized avatar

Ernad Husremović hernad

View GitHub Profile
// harbour -n selam.prg
procedure main()
QQout ("selam alejkum dunja: from harbour")
return
if (!exists('g:github_user') || !exists('g:github_token')) && !executable('git')
echoerr "Gist: require 'git' command"
finish
endif
class Person
attr_accessor :country, :country_options
def initialize
self.country_options=["", "Canada", "US", "Mexico"]
self.country = "Canada"
end
end
class HelloList
class Person
attr_accessor :provinces, :provinces_options
def initialize
self.provinces_options=[
"",
"Quebec",
"Ontario",
"Manitoba",
"Saskatchewan",
shell {
text "SWT"
tab_folder {
tab_item {
text "Tab 1"
label {
text "Hello World!"
}
}
tab_item {
module Etc
class Passwd < FFI::Struct
@@@
struct do |s|
s.include "sys/types.h"
s.include "pwd.h"
s.name "struct passwd"
s.field :pw_name, :string
s.field :pw_passwd, :string
require 'ffi'
module LibC
extend FFI::Library
callback :qsort_cmp, [ :pointer, :pointer ], :int
attach_function :qsort, [ :pointer, :int, :int, :qsort_cmp ], :int
end
p = MemoryPointer.new(:int, 2)
p.put_array_of_int32(0, [ 2, 1 ])
// gcc -rdynamic -o dlopen_e1 dlopen_e1 -ldl
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
int main(int argc, char **argv) {
void *handle;
double (*cosine)(double);
char *error;
@hernad
hernad / h2.rb
Created December 13, 2008 22:02
def f1(arg1, *args)
puts "argument count= #{args.size}"
puts "arg1= #{arg1}"
for i in 0..args.size-1
puts "args[#{i}] #{args[i]} "
puts "string ?", args[i].is_a?(String)
puts "integer ?", args[i].is_a?(Integer)
@hernad
hernad / gist:716071
Created November 25, 2010 23:30
enum dilema
enum Oznaka {A, B, C, D, E};
..
Oznaka ozn;
cout << "unesi oznaku:"
// ovo je bitno jer cin ne zna raditi direktno sa enum-om
cin >> (int) ozn;