Skip to content

Instantly share code, notes, and snippets.

View gavr123456789's full-sized avatar
🪂

gavr gavr123456789

🪂
View GitHub Profile
using Gtk;
public class MainWindow : Gtk.Window
{
private Box vboxMain;
private ScrolledWindow swFiles;
private TreeView tvFiles;
private TreeViewColumn colName;
/* The Computer Language Benchmarks Game
https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
contributed by Isaac Gouy
*/
// using System;
[Compact]
class NBody {
public static void main(string[] args) {
#include <stdint.h>
#include <stdalign.h>
#include <immintrin.h>
#include <math.h>
#include <stdio.h>
// intptr_t should be the native integer type on most sane systems.
typedef intptr_t intnative_t;
typedef struct{
void main(string[] args) {
int[] e = {};
for (int i=0,j=0;i<100;i++,j++) {
e+=j;e+=j;//заполнение парными
}
e+=100003;//уникальный
ulong micsec;
double sec;
public enum BinSide{
Left,
Right
}
public class BinaryTree{
public long? Data { get; private set; }
public BinaryTree Left { get; set; }
public BinaryTree Right { get; set; }
public BinaryTree Parent { get; set; }
void main(){
int a=5;
int b=3;
a ^= b;
b ^= a;
a ^= b;
print(@"$a, $b");
}
string task(string str){
var result = "";
unichar c;
for (int i = 0; str.get_next_char (ref i, out c);) {
if (c ==' ')result+="%20";
else result+=c.to_string();
}
return result;
}
namespace ObjectFactory {
private Gee.Map<Type, Type> _value_types;
public void set_value_type_for_prop_type (Type prop_type, Type value_type) {
if (_value_types == null) {
_value_types = new Gee.HashMap<Type, Type> ();
}
_value_types[prop_type] = value_type;
@gavr123456789
gavr123456789 / async_GTK_gui_example.vala
Last active July 25, 2024 01:23
async GTK 3 4 gui example vala nim
using Gtk;
Button button;
void main (string[] args) {
Gtk.init (ref args);
var window = new Window ();
button = new Button.with_label ("Start counting");
button.clicked.connect (() => {
@gavr123456789
gavr123456789 / isTypesTheSame.vala
Created January 5, 2021 02:10
check if all types are the same
bool sus(params Type[] types){
if (types.length != 0){
var a = types[0];
for (var i = 1; i < types.length; ++i){
if (!a.is_a(types[i]))
return false;
else
a = types[i];
}