This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] | |
extern crate nom; | |
use std::fmt::Write; | |
fn get_all_a(input: &[u8]) -> nom::IResult<&[u8], Vec<&[u8]>, u32> { | |
let io: (&[u8], Vec<&[u8]>) = { | |
let mut a_list: Vec<&[u8]> = vec!(); | |
let mut current_input: &[u8] = &b""[..]; | |
let input_length = input.len(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*-coding: utf-8 -*- | |
# B la base de points du niveau actuel | |
# N = 19, le nombre de niveaux | |
# P, les points obtenus à l'instant T | |
# J, le nombre de jours de présence potentiellement effectués | |
# dans le futur. | |
# U, le facteur multiplicateur activé si l'utilisateur a assisté à la dernière réunion. | |
# C, le coefficient de proportionnalité commun à chaque base (B). | |
# R (inconnue), le nombre de jours restants à jouer pour être promu. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate toml; | |
#[macro_use] | |
extern crate serde_derive; | |
macro_rules! generate_struct { | |
($struct_name:ident, $( $property_name:ident, $property_type:ty ),*) => ( | |
use std::fmt::Debug; | |
#[derive(Debug)] | |
struct $struct_name { | |
$( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> | |
<body ng-app="Foo" ng-controller="Controller"> | |
<tree-generator tree-title="pwet" sections="['bar', 'baz', 'bang']"></tree-generator> | |
<script> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Std | |
import unittest | |
# Third party | |
# Internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import pathlib | |
def create_relative_path(initial_path: pathlib.Path, new_root: str) -> pathlib.Path: | |
"""Creates a new path from the initial path. | |
Example: | |
your_path = pathlib.Path('/foo/bar/baz/bang') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python version: 3.6.3 | |
# See docs: | |
# * https://docs.djangoproject.com/en/1.11/ref/request-response/#django.http.HttpResponse | |
# * https://docs.djangoproject.com/en/1.11/ref/request-response/#httprequest-objects | |
# * https://docs.python.org/3/library/io.html?highlight=io%20bytesio#io.BytesIO | |
def zipfile_gen(request: django.http.HttpRequest) -> django.http.HttpResponse: | |
import pathlib | |
import io | |
text_file = pathlib.Path(__file__).parent / 'a_text_file.txt' | |
buffer = io.BytesIO() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const INLINE_TAG: &'static str = "[inline]"; | |
const CLOSED_INLINE_TAG: &'static str = "[/inline]"; | |
fn main() { | |
let raw_input = "`hello`"; | |
let couple = (INLINE_TAG, CLOSED_INLINE_TAG); | |
let delimiter = "`"; | |
let wrapped_content = wrap_with_couple_of_tag(raw_input.to_owned(), couple, delimiter); | |
assert_eq!(wrapped_content, "[inline]hello[/inline]"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn split(chaine: String) -> Vec<String> | |
{ | |
let lettres = chaine.chars(); | |
let mut newChaine : Vec<String> = Vec::new(); | |
let mut buffer : String = String::new(); | |
for lettre in lettres | |
{ | |
if lettre.is_whitespace() | |
{ | |
newChaine.push(buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sliceAt(initial_string, target) { | |
var index = initial_string.indexOf(target); | |
if (index !== -1) { | |
switch (index) { | |
case 0: return initial_string.substring(index + target.length); | |
case (initial_string.length - 1): return initial_string.substring(index, target.length - 1); | |
} | |
var first_part = ''; | |
var second_part = ''; | |
first_part = initial_string.substring(0, index); |
NewerOlder