Skip to content

Instantly share code, notes, and snippets.

View iwilllate's full-sized avatar

iwilllate

View GitHub Profile
@iwilllate
iwilllate / Good taste.md
Last active June 30, 2019 13:31 — forked from santisbon/Good taste.md
What makes good taste?

On Good Taste

Linus Torvalds in an interview talked about the idea of good taste in code or what I like to call elegance. As one might expect from two slides meant to make a point during a talk, he omits a lot of details to keep it short and simple. This post digs into the specifics of his example (deleting an element from a list) and adds another example (inserting an element in a list) including working code.

Example from Linus

This is an example of removing an element from a singly-linked list. It's one of the first data structures you learn about when you start learning about computer science and programming. The reason it doesn't show particularly good taste is because we have that condition at the end where we take a different action depending on whether the element we want to remove is at the beginning of the list or somewhere in the middle.

![Bad taste](http://

@Cartexius
Cartexius / install_gtest_ubuntu.md
Last active March 29, 2024 10:11
Install gtest in Ubuntu
@kristopherjohnson
kristopherjohnson / Makefile
Last active October 11, 2019 21:12
C program to convert Roman numerals to integer values
rn: rn.c
test: rn
./rn I IV V VI IX X XI XIV XIX XCIX CI MCMLXVII MD MDC MCD MM
.PHONY: test
@jeb2239
jeb2239 / main.cpp
Created February 28, 2017 22:09
Example C++ concepts with gcc 6.2 or greater
//compile this file with gcc 6.2 or greater
#include <iostream>
#include <string>
#include <locale>
#include <vector>
#include <cassert>
#include <list>
using namespace std::literals;
@santisbon
santisbon / Good taste.md
Last active July 13, 2023 15:16
What makes good taste? #linux #linus #torvalds

On Good Taste

Linus Torvalds in an interview talked about the idea of good taste in code or what I like to call elegance. As one might expect from two slides meant to make a point during a talk, he omits a lot of details to keep it short and simple. This post digs into the specifics of his example (deleting an element from a list) and adds another example (inserting an element in a list) including working code.

Example from Linus

This is an example of removing an element from a singly-linked list. It's one of the first data structures you learn about when you start learning about computer science and programming. The reason it doesn't show particularly good taste is because we have that condition at the end where we take a different action depending on whether the element we want to remove is at the beginning of the list or somewhere in the middle.

![Bad taste](http://

@JamesMenetrey
JamesMenetrey / copy-and-swap-idiom.cpp
Created May 8, 2016 22:05
C/C++ - The perfect Copy-And-Swap idiom usage
// Source: http://codereview.stackexchange.com/questions/95464/is-the-copy-swap-idiom-implemented-here-correctly
class Array
{
int size;
int* data;
public:
Array(Array const& copy)
: size(copy.size)
, data(new int[size])
@BCasal
BCasal / Colaborar Proyecto GitHub.markdown
Last active May 15, 2024 15:24
Pasos a seguir para colaborar en un proyecto de GitHub

Cómo colaborar en un proyecto en GitHub

  • Fork del repositorio
  • Clonar el repositorio
  • Actualizar la rama master
  • Crear una rama
  • Hacer los cambios
  • Hacer un Pull Request

Fork del repositorio

@stevenpray
stevenpray / fizzbuzz.c
Created April 16, 2014 04:02
FizzBuzz C
/**
* FizzBuzz
*
* A program that prints the numbers from 1 to 100.
* Multiples of three print “Fizz” instead of the number, and multiples of five print “Buzz”.
* For numbers which are multiples of both three and five print “FizzBuzz”.
*/
#include <stdio.h>
@seankross
seankross / Update Fork.md
Last active August 9, 2022 18:06
Update a Github Fork from the Original Repo

Taken from here

Add remonte branch:

git remote add --track master mleung git://github.com/mleung/feather.git

Verify:

git remote

@weidagang
weidagang / cpp_producer_consumer.cpp
Last active April 4, 2022 03:21
Implement producer/consumer (multiple producers, multiple consumers) problem with buffer size = 10.
/**
C++ Producer Consumer using C++11 thread facilities
To compile: g++ -std=c++11 <program name> -pthread -lpthread -o pc
*/
#include <iostream>
#include <sstream>
#include <vector>
#include <stack>
#include <thread>
#include <mutex>