Skip to content

Instantly share code, notes, and snippets.

View arnaudfl's full-sized avatar
🦄
Marvelous code

Arnaud F. arnaudfl

🦄
Marvelous code
View GitHub Profile
import React from "react";
import { useQuill } from "react-quilljs";
import "quill/dist/quill.snow.css";
import "../styles/quill.editor.css";
interface EditorProps {
value: string;
placeholder: string;
onChange: (value: string) => void;
import React, { useState } from "react";
import { Controller, useForm, SubmitHandler } from "react-hook-form";
import { Layout } from "./components/Layout";
import { Editor } from "./components/Editor";
interface IFormInput {
title: string;
content: string;
}
@arnaudfl
arnaudfl / postman-deb.sh
Created September 16, 2019 12:42 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
ls Postman*.tar.gz > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Removing old Postman tarballs"
rm -f $(ls Postman*.tar.gz)
fi
echo "Downloading latest Postman tarball"
curlExists=$(command -v curl)
@arnaudfl
arnaudfl / BrowserHistory.js
Created May 16, 2019 13:11
Intercept and disable browser's back button action
// How to use it: import this function from another file and run it
// import DisableBack from 'BrowserHistory';
// DisableBack();
// intercept browser's back button action and disable it
function DisableBack() {
window.history.pushState(null, null, window.location.href);
window.onpopstate = function onPopState() {
window.history.go(1);
};
@arnaudfl
arnaudfl / component.js
Last active April 28, 2017 08:28
An example under Ember to display all the pages of a PDF document as images data using the PDFJS library. The file is not functional, there is only the function for displaying the canvas.
import Ember from 'ember';
export default Ember.Component.extend({
showDocumentImages: function() {
// fix canvas file not rendering properly in Ember
avoidEnumerableNativeExtensions(Array.prototype);
avoidEnumerableNativeExtensions(Function.prototype);
avoidEnumerableNativeExtensions(String.prototype);
function avoidEnumerableNativeExtensions(proto) {
Object.keys(proto) // already gets all enumerables, no need to filter
if (data.fieldType === 'Sig') {
this.setFlags(AnnotationFlag.HIDDEN);
}
@arnaudfl
arnaudfl / is_no_defined_ember.md
Created March 9, 2017 07:44
How to prevent message '... is not defined' warning in Ember

How to prevent message '... is not defined' warning in Ember

A simple todo to prevent a message as below from showing (in a terminal) while building with Ember. For example if you use a jQuery Plugin like Chart.

controllers/application.js: line 8, col 11, 'Chart' is not defined.

Try to add Chart as predef in your .jshintrc file.

"predef": [
 "document",
@arnaudfl
arnaudfl / ember_intl.md
Last active March 8, 2017 08:38
How using translation keys in components with Ember.js

How using translation keys in components with Ember.js

A simple todo to explain how inject and use translation keys in components with Ember.js

1) Inject intl service

//app/pods/components/dummy-component/component.js
import Ember from 'ember';

export default Ember.Component.extend({