Skip to content

Instantly share code, notes, and snippets.

View JamesMenetrey's full-sized avatar
🐹
Shifting some bits ...

Jämes Ménétrey JamesMenetrey

🐹
Shifting some bits ...
View GitHub Profile
@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])
@JamesMenetrey
JamesMenetrey / git-real-world-commands.md
Last active April 22, 2020 12:26
git real world commands

git real world commands

Checking out

Review unstaged changes

git add -p
@JamesMenetrey
JamesMenetrey / zsh-commands-reminder
Created October 21, 2016 18:44
Zsh commands reminder
# Zsh commands reminder
## Create an alias for a directory
```
hash -d name=~path
```
## Sources
@JamesMenetrey
JamesMenetrey / glut_shapes.c
Created March 28, 2017 21:04
GLUT - Shapes generation source
/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
/**
(c) Copyright 1993, Silicon Graphics, Inc.
ALL RIGHTS RESERVED
Permission to use, copy, modify, and distribute this software
for any purpose and without fee is hereby granted, provided
@JamesMenetrey
JamesMenetrey / CollisionManager.java
Created April 14, 2017 16:13
Collision manager for OpenGL in Java
package ch.heigvd.infogr.maths.collision;
import ch.heigvd.infogr.maths.Vector3;
import ch.heigvd.infogr.maths.collision.algorithms.AaBbBoxedCollisionAlgorithm;
import ch.heigvd.infogr.maths.collision.algorithms.ICollisionAlgorithm;
import ch.heigvd.infogr.maths.collision.representation.IBoxedCollidable;
import ch.heigvd.infogr.maths.collision.representation.ICollidable;
import com.jogamp.opengl.GL2;
import javafx.util.Pair;
@JamesMenetrey
JamesMenetrey / README.md
Last active September 29, 2022 08:27
Install Oh-My-Zsh + iTerm2 with Solarized + System-wide console in 2017 (macOS)

Install iTerm2 with Solarized in 2017

Here is the looks and feel of your terminal once the tutorial has been applied on your system:

Install iTerm2

Using Homebrew:

@JamesMenetrey
JamesMenetrey / README.md
Last active June 12, 2020 14:39
Generate a valid SSL certificate with public/private key for wildcard domains (compatible with IIS) - 2017

Generate a valid SSL certificate with public/private key for wildcard domains (compatible with IIS) - 2017

Create the configuration file

Open a text editor and paste the following configuration. Save it and name it config.txt.

[req] 
distinguished_name = req_distinguished_name 
x509_extensions = v3_req 
prompt = no 
@JamesMenetrey
JamesMenetrey / demo.scala
Created October 9, 2017 12:51
Abstract type members in Scala
package scalaInAction.chapter8ScalableExtensibleComponents
import org.scalatest.{FlatSpec, Matchers}
class Food
class Grass extends Food
abstract class Animal {
type SuitableFood <: Food // Upper bound (<:)
@JamesMenetrey
JamesMenetrey / demo.scala
Last active October 9, 2017 22:42
Structural types in Scala: IDisposable (.NET) rewritten using duck typing.
package scalaInAction.chapter8ScalableExtensibleComponents
import org.scalatest.{FlatSpec, Matchers}
/**
* Declare the .NET keyword as a singleton.
*/
object using {
/**
* Type alias.
@JamesMenetrey
JamesMenetrey / demo.scala
Created October 11, 2017 12:40
Higher-kinded types in Scala
package scalaInAction.chapter8ScalableExtensibleComponents
import org.scalatest.{FlatSpec, Matchers}
trait HasAtLeastOneElement[F[_]] {
def any[A](xs: F[A]): Boolean
}
/**
* Higher-kinded types are types that know how to create a new type from the type argument. That's why