Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♂️
migrated to my own gitlab and gitlab.com #ByeMicrosoft

Charles-Édouard Coste charlycoste

🏃‍♂️
migrated to my own gitlab and gitlab.com #ByeMicrosoft
View GitHub Profile
@charlycoste
charlycoste / Makefile
Last active Sep 3, 2020
Sample shell.nix for Sylius project (PHP)
View Makefile
.PHONY: build install test
build:
composer install --no-scripts
bin/console assets:install
bin/console sylius:install:assets
bin/console sylius:theme:assets:install
yarn install
yarn run build
yarn encore dev
@charlycoste
charlycoste / index.html
Created Feb 28, 2018
Quick and dirty link checker
View index.html
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E=" crossorigin="anonymous"></script>
<script>
$(function(){
$('body').html($('#tpl-form').html());
});
$(document).on('submit', function(e){
@charlycoste
charlycoste / movable.coffee
Last active Aug 30, 2020
Movable HTML bloc with BackboneJS
View movable.coffee
class Movable extends Backbone.View
events:
'mousedown': 'grab'
'mouseup': 'release'
'mouseleave': 'release'
'mousemove': 'move'
'mouseover': -> @$el.css 'cursor', 'grab'
move: (e)->
return unless @moving
View Perceptron.php
<?php
class Perceptron
{
private $weights;
public function __construct($n)
{
for ($i=0; $i<$n; $i++) {
$this->weights[$i] = rand()/getrandmax()-0.5;
}
@charlycoste
charlycoste / ocr.php
Last active May 5, 2016
Analyse de relevés de compte LCL
View ocr.php
<?php
$dir = './Relevés/';
$files = scandir($dir);
$regex = [
'/SOLDE INTERMEDIAIRE[^\d]+([\d ]+,\d{2})/'=>'intermediaire',
'/^\s+$/'=>'vide',
'/du \d{2}.\d{2}.\d{4} au \d{2}.\d{2}.\d{4}.*N°\s+\d+/'=>'numérotation',
'/RELEVE DE COMPTE COURANT/'=>'Titre',
View gist:bc4ee758999732fc77a9
Ancien solde
/^01(.{5})(.{4})(.{5})(.{3})(.{1})(.{1})(.{11})(.{2})(.{6})(.{50})(.{14})(.{16})$/
Mouvement
/^04(.{5})(.{4})(.{5})(.{3})(.{1})(.{1})(.{11})(.{2})(.{6})(.{2})(.{6})(.{31})(.{2})(.{7})(.{1})(.{1})(.{14})(.{16})$/
@charlycoste
charlycoste / download_github_bills.coffee
Last active Aug 29, 2015
Automatically download github bills with CasperJS
View download_github_bills.coffee
login = "<login>"
password = "<password>"
directory = "<directory>"
organization = "<organization>"
casper = require('casper').create
verbose: true
logLevel: "debug"
getLinks = ->
View docx.xml
<w:p>
<w:pPr>
<w:pStyle w:val="Corpsdetexte"/>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="15"/>
</w:numPr>
<w:tabs>
<w:tab w:val="left" w:pos="0" w:leader="none"/>
</w:tabs>
View script.js
document.onmousemove = function(e){
var rect = document.getElementById('r');
rect.setAttribute('x',e.clientX-(rect.getAttribute('width')/2));
rect.setAttribute('y',e.clientY-(rect.getAttribute('height')/2));
};
document.onclick = function(e){
var point = document.createElementNS("http://www.w3.org/2000/svg",'rect');
var rect = document.getElementById('r');
@charlycoste
charlycoste / ezcPersistentXmlManager.php
Created Mar 10, 2014
Persistent Manager avec prise en charge de XML
View ezcPersistentXmlManager.php
<?php
class ezcPersistentXmlManager extends ezcPersistentDefinitionManager
{
private $file;
public function __construct( $file )
{
if( file_exists($file) )
$this->file = $file;
}