Skip to content

Instantly share code, notes, and snippets.

View Fcmam5's full-sized avatar
🇩🇿
I may be slow to respond.

Fortas Abdeldjalil Fcmam5

🇩🇿
I may be slow to respond.
View GitHub Profile
@Fcmam5
Fcmam5 / ber.js
Last active February 10, 2021 13:40
Berber (Tifinagh) regex
const REGEX = /^[\u2D30-\u2D7F\\s]+$/
// Examples
console.log(REGEX.test("ⵡⴻⵀⵔⴰⵏ")); // True
console.log(REGEX.test("Oran")); // False
@Fcmam5
Fcmam5 / RichEditor.js
Last active January 31, 2021 05:12
Quill-React embed image example with a functional component
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';
import { modules, formats } from './config';
function RichEditor({ store, attribute, placeholder }) {
let quillRef = null;
let reactQuillRef = null;
@Fcmam5
Fcmam5 / constants.py
Last active September 5, 2018 06:43
Algerian administrative devisions (Wilaya-ولايات الجزائر) as constant for Django choice field
from django.utils.translation import gettext_lazy as _
WILAYAS = [
( 0, 'International'),
( 1, '01- {}'.format(_('Adrar')) ),
( 2, '02- {}'.format(_('Chlef')) ),
( 3, '03- {}'.format(_('Laghouat')) ),
( 4, '04- {}'.format(_('Oum El Bouaghi')) ),
( 5, '05- {}'.format(_('Batna')) ),
( 6, '06- {}'.format(_('Béjaïa')) ),
#!/usr/bin/env python
# # -*- coding: utf-8 -*-
from pyknow import *
class Personne(Fact):
"""Info about the patient"""
pass
class InreferenceEngine(KnowledgeEngine):
@Fcmam5
Fcmam5 / Vuejs simple slider.js
Created April 27, 2018 14:33
Quick example for a friend during Hack!T.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello Slider</title>
</head>
<body>
@Fcmam5
Fcmam5 / main.js
Created September 10, 2017 23:03
$(document).ready(function(){
var chart;
var socket = io.connect('/');
socket.on('chart-change', function(str){
var newsObject = JSON.parse(str);
myApplication.$data.currencies = newsObject.list.split('%%');
if (newsObject.removedItem.length === 3) {
chart.load({
columns: myApplication.$data.cols,
unload: [newsObject.removedItem],
@Fcmam5
Fcmam5 / _undersocre_variables_.c
Created April 27, 2017 11:45
A teacher said you can't name variables with just underscores, or too many underscores... So I tested it :-)
#include <stdio.h>
int _______________________(int _____, int ___________){
int ___________________________________;
___________________________________ = _____ + ___________;
return ___________________________________;
}
int main() {
float _ = .555;
int __;
@Fcmam5
Fcmam5 / test.mod
Created November 26, 2016 20:31
AMPL and CPLEX example model for (https://www.youtube.com/watch?v=Mr5Kz2JLC8o)
var x1 >= 0;
var x2 >= 0;
maximize fct: 6*x1 + 4*x2;
subject to test1: 3*x1 + 9*x2 <=81;
subject to test2: 4 * x1 + 5 * x2 <= 55;
subject to test3: 2 * x1 + x2 <= 20;
@Fcmam5
Fcmam5 / exo2.l
Last active November 9, 2016 08:06
Compilation L3 analyseur syntaxique
%{
#include <stdio.h>
%}
chiffre [0-9]
lettre [a-z]|[A-Z]
%%
{lettre}({chiffre}|{lettre})* {printf("Identifiant reconnu: %s de longuer %d\n", yytext, yyleng);}
({chiffre})+ {printf("Nombre reconnu:");ECHO;printf("\n");}
[^a-z]|[^A-Z]|[^0-9]
%%
@Fcmam5
Fcmam5 / programAsynch.js
Created August 13, 2016 11:08
A "" cat file | wc -l "" like program for #learnyounode
var fs = require("fs");
//Readfile
fs.readFile(process.argv[2], (err, content) =>{
if (err) {
throw err;
}
else{
var buffer = content.toString();
var bufferArray = buffer.split('\n');
console.log((bufferArray.length-1));