Skip to content

Instantly share code, notes, and snippets.

Marc-André Cournoyer macournoyer

Block or report user

Report or block macournoyer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
/// A solver for Ruzzle (
/// Finds all the word combinations in a 4x4 grid of letters.
/// Requires a dictionnary (one word per line) in words.txt.
use std::collections::HashSet;
use std::fs::File;
use std::io::{self, BufReader};
use std::io::prelude::*;
const MIN_WORD_SIZE: usize = 5;
macournoyer / Output
Last active Jun 4, 2019
A Neural Network framework in 25 LOC
View Output
$ python
Epoch 0 MSE: 1.765
Epoch 100 MSE: 0.015
Epoch 200 MSE: 0.005
* Target MSE reached *
1 XOR 0 = 1 ( 0.904) Error: 0.096
0 XOR 1 = 1 ( 0.908) Error: 0.092
1 XOR 1 = 0 (-0.008) Error: 0.008
macournoyer / game.litcoffee
Last active Apr 14, 2017
JavaScript Game Basics in (Literate) CoffeeScript
View game.litcoffee

The game we're building is a simple side-scrolling racing game. The player's car is static on the screen, only the background is moving. The enemies are planes whom the player must dodge using the up and down arrow keys. If the player hits a plane, he dies. One point is given each time a plane goes off screen without touching the player.


Our game is composed of sprites. Each sprite has a position (x, y), velocity (speed) and one image, or more if animated.

Images are loaded from the DOM using their CSS selector (imagesSelector). We use ID selectors (#name) for single images and class selectors (.name) for animated sprites composed of several images.

See the images used in the game.

macournoyer /
Created Sep 13, 2013
Sublime Text 2 RubyEval hack
import subprocess
import sublime, sublime_plugin
class EvalAsRuby:
def ruby(self):
return self.view.settings().get("ruby_eval").get("ruby")
except AttributeError:
return "ruby"
View donut.rb
include Math;R1=1.0; R2=2.0;K2=5.0
SS=40;K1=SS*K2*3/(8*(R1+R2));def rf(a, b)
cosA=cos(a);sinA=sin(a);cosB=cos(b);sinB=sin(b){' ')};b=Array.
new(SS).fill{}; t=0.0;while t<2*PI
cost=cos(t);sint=sin(t);p=0.0;while p<2*PI;cosp=cos(p);sinp=
sin(p);cx=R2+R1*cost;cy=R1* sint;x=cx*(cosB*cosp+sinA*
sinB*sinp)-cy*cosA*sinB; y=cx*(sinB*cosp-sinA*##
cosB*sinp)+cy*cosA*cosB ;z=K2+cosA*cx*sinp+cy*
sinA;ooz=1/z;xp=(SS/2+K1* ooz*x).to_i ;yp= (SS/2-
macournoyer / Dockerfile
Last active Dec 14, 2019
Playing w/ Dockerfile on OS X
View Dockerfile
FROM base
MAINTAINER Marc-Andre Cournoyer ""
RUN apt-get -y update
RUN apt-get install -y -q curl
RUN curl -L | bash -s stable --ruby
RUN /bin/bash -l -c rvm requirements
macournoyer / abc.rb
Created Nov 5, 2012
First programming lesson w/ my 4yo daughter
View abc.rb
alphabet = 'A'..'Z'
`say "#{alphabet.to_a.join(', ')}"`
View gist:3298395
class ModifyResponseHeaders
def initialize(app)
@app = app
def call(env)
status, headers, body =
headers["cache"] = "..."
[status, headers, body]
macournoyer / .gitconfig
Last active Sep 30, 2015
Git shortcuts
View .gitconfig
st = status
s = status
co = checkout
c = commit -v
ci = commit -a -v
b = branch
d = diff
p = pull
a = add -A .
You can’t perform that action at this time.