Prénom Nom, MCF/PR

Écrire un syllabus ou un post

Vous apprendrez comment écrire facilement un syllabus ou un post, puis à le publier par courriel ou directement par github.

Publier par courriel

  1. Télécharger le modèle.
  2. Le renvoyer par mail complété et accompagné des éventuelles ressources (diapositives, images, et vidéos).

Publier par github

Suivez le guide du contributeur.

Insérer des liens

La gestion des ressources multimédia n’est jamais simple. Toutes les ressources sont placées dans un même répertoire. La macro link-asset vous permet de faire des liens facilement.

Pour notre modèle, les ressources sont dans le répertoire :

/master-info/assets/divers/modele-syllabus/

Par exemple, on peut insérer une image centrée PhD Comics

ou une image réduite insérée dans le texte PhD Comics .

Exemple de code

Python

def dump_args(func):
    "This decorator dumps out the arguments passed to a function before calling it"
    argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
    fname = func.func_name
    def echo_func(*args,**kwargs):
        print fname, ":", ', '.join(
            '%s=%r' % entry
            for entry in zip(argnames,args) + kwargs.items())
        return func(*args, **kwargs)
    return echo_func

@dump_args
def f1(a,b,c):
    print a + b + c

f1(1, 2, 3)

def precondition(precondition, use_conditions=DEFAULT_ON):
    return conditions(precondition, None, use_conditions)

def postcondition(postcondition, use_conditions=DEFAULT_ON):
    return conditions(None, postcondition, use_conditions)

class conditions(object):
    __slots__ = ('__precondition', '__postcondition')

    def __init__(self, pre, post, use_conditions=DEFAULT_ON):
        if not use_conditions:
            pre, post = None, None

        self.__precondition  = pre
        self.__postcondition = post

C++

#include "algostuff.hpp"
using namespace std;

bool bothEvenOrOdd (int elem1, int elem2) {
    return elem1 % 2 == elem2 % 2;
}

int main() {
    vector<int> coll1;
    list<int> coll2;

    float m = 40.0f;

    INSERT_ELEMENTS(coll1,1,7);
    INSERT_ELEMENTS(coll2,3,9);

    PRINT_ELEMENTS(coll1,"coll1: \n");
    PRINT_ELEMENTS(coll2,"coll2: \n");

    // check whether both collections are equal
    if (equal (coll1.begin(), coll1.end(),  // first range
               coll2.begin())) {            // second range
        cout << "coll1 == coll2" << endl;
    } /* TODO Shouldn't there be an 'else' case? */

    // check for corresponding even and odd elements
    if (equal (coll1.begin(), coll1.end(),  // first range
               coll2.begin(),               // second range
               bothEvenOrOdd)) {            // comparison criterion
        cout << "even and odd elements correspond" << endl;
    }
}

Java

import java.io.*;
import java.util.*;

public class KeyboardIntegerReader {

  public static void main (String[] args) throws java.io.IOException {
    String s1;
    String s2;
    int num = 0;

    // set up the buffered reader to read from the keyboard
    BufferedReader br = new BufferedReader (new InputStreamReader (
              System.in));

    boolean cont = true;

    while (cont) {
      System.out.print ("Enter an integer:");
      s1 = br.readLine();
      StringTokenizer st = new StringTokenizer (s1);
      s2 = "";

      while (cont && st.hasMoreTokens()) {
        try {
          s2 = st.nextToken();
          num = Integer.parseInt(s2);
          cont = false;
        }
        catch (NumberFormatException n) {
          System.out.println("The value in \"" + s2 + "\" is not an integer");
        }
      }
    }

    System.out.println ("You entered the integer: " + num);
  }
}

Javascript

$(function(){
 var t,
   $links = $('link[title]'),
   $select = $('select'),
   theme = "Native-Mod",
   ls = false,
   selectTheme = function(theme){
     $links.prop('disabled', true);
     $links.filter('[title="' + theme + '"]').prop('disabled', false);
   };
 // https://gist.github.com/paulirish/5558557
 if ("localStorage" in window) {
   try {
     window.localStorage.setItem('_tmptest', 'temp');
     ls = true;
     window.localStorage.removeItem('_tmptest');
   } catch(e) {}
 }
 if (ls) {
   theme = localStorage['github-dark-theme'] || theme;
 }

 t = '';
 $links.each(function(){
   t += '<option>' + this.title + '</option>';
 });
 $select
   .append(t)
   .on('change', function(){
     selectTheme(this.value);
     if (ls) {
       localStorage['github-dark-theme'] = this.value;
     }
   })
   .val(theme);

 $(window).load(function(){
   $select.val(theme);
   selectTheme(theme);
 });

});

Normal code block

/** Comment */
public void method();

Some extra explanation to help understand the code.

Code block with title

/** Comment */
public void method();

Code block with Liquid code

{% for tag in site.data.tags %}<li>{{ tag.name }}{% unless forloop.last %}, {% endunless %}</li>{% endfor %}

Code block for shell

me@laptop$ command args "more args"
output text from command
though output may be highlighted weirdly

Quotes

Here’s a short quotation which is in the middle of a sentence.

This is a long quotation by someone, normal markdown formatting rules apply:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del TWiStErRob

Program output text output from file.name in library

Alerts

All alerts support markdown and their names are all lowercase, because they’re used as CSS classes, for example TODO is alert todo=. The TODO: prefix is not automatically inserted, it’s for name calling only here.

Alert:
This is like any normal markdown, even when used from non-markdown context:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del.

Warning: call out a caveat that’s easy to trigger
This is like any normal markdown, even when used from non-markdown context:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del.

Info: supplementary information, for example links to further reading or documentation.
This is like any normal markdown, even when used from non-markdown context:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del.

Tip: call out something non-trivial that could help.
This is like any normal markdown, even when used from non-markdown context:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del.

Success:
This is like any normal markdown, even when used from non-markdown context:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del.

Text:
This is like any normal markdown, even when used from non-markdown context:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del.

TODO: reminder to myself that something needs to be done here
This is like any normal markdown, even when used from non-markdown context:
strong, em, em, strong em, html bold, code, kbd, samp, ins, del.

Terminal:
This is like any normal markdown, even when used from non-markdown context: **strong**, *em*, _em_, ***strong em***, html bold, `code`, kbd, samp, ins, del.