Skip to content

Instantly share code, notes, and snippets.

View c-jacquin's full-sized avatar

Charles Jacquin c-jacquin

  • Freelance
  • Paris Fr
View GitHub Profile
@c-jacquin
c-jacquin / foo.ts
Created September 4, 2023 13:43
parse csv
export async function csvToJsonAsync(path: string) {
const bottles: any[] = [];
const readable = fs.createReadStream(path, { encoding: 'utf-8' });
const rl = readline.createInterface({
input: readable,
output: process.stdout,
});
let isFirstLine = true;
let headers: string[];
@c-jacquin
c-jacquin / index.js
Created August 2, 2023 19:15
nodejs async with stream
const fs = require("node:fs");
const { Transform, Readable } = require("node:stream");
const INPUT = ["aaa", "aAa", "aab"];
const regex = /aaa/i;
// logger helper
function create_logger(prefix) {
return {
log: (...[message, ...args]) =>
@c-jacquin
c-jacquin / input.ts
Created October 17, 2018 17:43
Material Input
import autobind from 'autobind-decorator';
import glamorous from 'glamorous';
import React from 'react';
import { theme } from '../styles/theme';
interface TextInputProps {
type?: string;
value?: string;
label?: string;
@c-jacquin
c-jacquin / mock.js
Created July 24, 2018 09:42
Mock your graphql api
import { mockServer } from 'graphql-tools';
import schema from './schema.graphql'
const mockApi = mockServer(schema, {
Int: () => 6,
Float: () => 22.1,
String: () => 'Hello',
});
expressApp.post('/graphql', async (req, res) => {
.album{
text-align: center;
background: #333;
padding: 10px 20px;
border:#666 1px solid;
}
.album-thumb{
width:100%;
}
.artist-header{
padding-bottom:20px;
margin-bottom:20px;
border-bottom:solid 1px #000;
}
.artist-thumb{
width:80px;
height:auto;
float:left;
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Hero } from '../shared/hero';
import { forbiddenNameValidator } from '../shared/forbidden-name.directive';
@Component({
moduleId: module.id,
selector: 'hero-form-reactive3',
templateUrl: 'hero-form-reactive.component.html'
})
export class HeroFormReactiveComponent implements OnInit {
import { createStore, applyMiddleware, compose } from 'redux';
import createLogger from 'redux-logger';
import rootReducer from '../reducers';
const isDev = process.env.NODE_ENV === 'development';
function getMiddleware() {
const middleware = [];
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi