Skip to content

Instantly share code, notes, and snippets.

View djberg96's full-sized avatar

Daniel Berger djberg96

View GitHub Profile
class Foo
include Comparable(self)
getter name : String
getter age : Int32
def initialize(@name, @age)
end
def <=>(other : self)
class Mineral
getter name : String
getter hardness : Float64
getter crystal_struct : String
def initialize(name, hardness, crystal_struct)
@name = name
@hardness = hardness
@crystal_struct = crystal_struct
end
double_prop.cpp: In function ‘VALUE doubleProp_set(VALUE, VALUE, VALUE)’:
double_prop.cpp:28:22: error: ‘RFLOAT’ was not declared in this scope; did you mean ‘T_FLOAT’?
28 | (*prop) (*row) = RFLOAT (val)->value;
| ^~~~~~
| T_FLOAT
double_prop.cpp: In function ‘VALUE doubleProp_as_row(VALUE, VALUE)’:
double_prop.cpp:37:47: error: ‘RFLOAT’ was not declared in this scope; did you mean ‘T_FLOAT’?
37 | return wrap_row (new c4_Row (prop->AsRow (RFLOAT (i)->value)));
| ^~~~~~
| T_FLOAT
Post-install message from sass:
Ruby Sass has reached end-of-life and should no longer be used.
* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
primary implementation: https://sass-lang.com/install
* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
sassc gem: https://github.com/sass/sassc-ruby#readme
#include "ruby.h"
VALUE cBar;
struct stuff_struct {
int length;
int data[];
};
static VALUE bar_foo(VALUE self){
@djberg96
djberg96 / bar.c
Last active November 30, 2020 18:21
#include "ruby.h"
VALUE cBar;
struct stuff_struct {
int age;
int data[];
};
static VALUE bar_foo(VALUE self){
# azure_metrics_memory.rb
# -- Get memory information from a diagnostics storage account
require 'azure-armrest'
require 'pp'
# Put your real credentials here
conf = Azure::Armrest::Configuration.new(
:subscription_id => 'xxx',
:tenant_id => 'xxx',
require 'rugged'
def credentials_cb
cred = Rugged::Credentials::UserPassword.new(
:username => 'djberg96',
:password => 'xxxxxxxx'
)
yield cred
end
require 'benchmark'
MAX = 10000000
Benchmark.bm(30) do |x|
x.report("require") do
MAX.times { require 'ffi' }
end
x.report("require unless") do
MAX.times { require 'ffi' unless defined?(FFI) }
require 'benchmark'
MAX = 10000000
Benchmark.bm(30) do |x|
x.report("require") do
MAX.times { require 'ffi' }
end
x.report("require unless") do
MAX.times { require 'ffi' unless defined?(FFI) }