Skip to content

Instantly share code, notes, and snippets.

View jonathansty's full-sized avatar

Jonathansty jonathansty

View GitHub Profile
@jonathansty
jonathansty / BinaryTree.rs
Created February 4, 2019 10:57
A naïnve implementation of a binary tree in rust.
struct Node<T: Ord> {
data : T,
left : Option<Box<Node<T>>>,
right : Option<Box<Node<T>>>,
}
impl<T: Ord> Node<T> {
pub fn new(data : T) -> Self {
@jonathansty
jonathansty / pr.md
Last active October 11, 2018 21:04 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jonathansty
jonathansty / EasyPPMSaving.cpp
Created August 6, 2016 10:11
Easy way of saving images in the .ppm format for viewing on linux.
#include <iostream>
#include <string>
#include <fstream>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
struct Sample
{
unsigned char r = 0;