Skip to content

Instantly share code, notes, and snippets.

View ElenaMerelo's full-sized avatar

Elena Merelo ElenaMerelo

  • Granada, Spain.
View GitHub Profile
@romeroyonatan
romeroyonatan / hello-openmp.c
Last active March 15, 2020 14:49
Hello world in OpenMP. Minimal example
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#define PARENT_TID 0
int main() {
int tid;
#pragma omp parallel
{
@JamesMGreene
JamesMGreene / example_def.rb
Last active September 15, 2018 09:00
Ruby class methods vs. instance methods
class Human
# Class method (a.k.a. static method)
def self.classification
'Mammal'
end
# Instance constructor
def initialize(first_name, last_name)
@developius
developius / README.md
Last active March 14, 2025 17:38
Setup SSH keys for use with GitHub/GitLab/BitBucket etc
@mycodeschool
mycodeschool / PreorderInorderPostorder_CPP.cpp
Last active May 3, 2025 17:50
Binary tree traversal: Preorder, Inorder, Postorder
/* Binary Tree Traversal - Preorder, Inorder, Postorder */
#include<iostream>
using namespace std;
struct Node {
char data;
struct Node *left;
struct Node *right;
};
@virajkulkarni14
virajkulkarni14 / gist:8770075
Last active March 14, 2018 12:02 — forked from kinopyo/gist:5682347
Conceptual Differences between Ruby's to_s and to_str methods

Concept

(The blockquote style does not look so well so I just pasted directly, but these are all quoted from the links in the bottom of this page)

You should not implement to_str unless your object acts like a string, rather than just having a string representation. The only core class that implements to_str is String itself.

[to_i and to_s] are not particularly strict: if an object has some kind of decent representation as a string, for example, it will probably have a to_s method… [to_int and to_str] are strict conversion functions: you implement them only if you object can naturally be used every place a string or an integer could be used.

to_str is used by methods such as String#concat to convert their arguments to a string. Unlike to_s, which is supported by almost all classes, to_str is normally implemented only by those classes that act like strings. Of the built-in classes, only Exception and String implement to_str

@yassersouri
yassersouri / Assignments Latex Template.md
Last active November 8, 2021 03:46
Assignments Latex template.

##Assignments Latex Template

###V 0.1

I always wanted some latex template that I could use for assignments. But none of the templates I found online had all the features I wanted. So the natural next step for me was to create one.

###Notes:

  • Use with XeLaTeX
@aspyct
aspyct / signal.c
Last active February 19, 2024 11:24
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* [email protected]
* http://aspyct.org
*
* Hope it helps :)
*/
#include <stdio.h>
#include <stdlib.h>