Skip to content

Instantly share code, notes, and snippets.

Felipe felipeochoa

Block or report user

Report or block felipeochoa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@felipeochoa
felipeochoa / quill-blots.org
Created Jan 13, 2018
Notes to self on blots in quill
View quill-blots.org

Quill Blots

There are four options for creating a custom blot:

——-——–+——-+

InlineBlock

——-——–+——-+

Embed

——-——–+——-+

Text
@felipeochoa
felipeochoa / pp-debug.el
Last active Sep 24, 2018
Pretty print emacs debug frames
View pp-debug.el
;;; pp-debug.el --- Pretty-printing debugger -*- lexical-binding: t -*-
;; Copyright (C) 2018 Felipe Ochoa
;; Author: Felipe Ochoa
;; Created: 5 Dec 2017
;; License: GPLv3
;;; Commentary:
;;; Pretty-print debugger frames.
@felipeochoa
felipeochoa / mu4e-ical.el
Created Oct 2, 2017
Display iCal details inline with mu4e
View mu4e-ical.el
(defun fov-ical-mark-body-text (oldfun msg)
"Wrap (OLDFUN MSG) with (propertize * 'fov-ical-message-body-text t)."
(propertize (funcall oldfun msg) 'fov-ical-message-body-text t))
(advice-add 'mu4e-message-body-text :around 'fov-ical-mark-body-text)
(defvar mu4e~view-msg)
(defun fov-ical-insert-info ()
"Submit async requests to insert ical info the current mu4e-view buffer."
(dolist (part (mu4e-message-field mu4e~view-msg :parts))
@felipeochoa
felipeochoa / debug-js2-ast.el
Last active Sep 4, 2018
Helper for debugging js2 ast
View debug-js2-ast.el
(defsubst js2-node-very-short-name (n)
"Return the very short name of node N as a string, e.g. `if'."
(replace-regexp-in-string "-node$" ""
(replace-regexp-in-string "^js2-" ""
(js2-node-short-name n))))
(defun debug-js2-ast ()
(interactive)
(if-let ((buf (current-buffer))
(top js2-mode-ast))
View AutoTextarea.jsx
import React from 'react';
import autosize from 'autosize';
class AutoTextarea extends React.Component {
constructor(props) {
super(props);
this.refHandler = this.refHandler.bind(this);
this.textarea = null;
}
View Most common 1 and 2-grams.md

Just built my app as a single bundle using Webpack, babel, and UglifyJS. It came out to 1,283,741 characters.

Here are the most space-consuming words in the resulting in the resulting bundle, how often they occur, and the total number of characters they take up:

word occurences chracters
function 8764 70,112
View comment-form.js
const quillModules = {
toolbar: ["bold", "italic", "underline", "strike"],
// mentions is added in constructor
keyboard: {
bindings: {
tab: {
key: 9,
handler: function(range, context) {
return this.quill.mentionHandler(range.context);
}
@felipeochoa
felipeochoa / el-reportero.js
Created Apr 5, 2017
JSON reporter for jest
View el-reportero.js
const fs = require("fs");
const path = require("path");
const mkdirp = require("mkdirp");
// when use use fit, jasmine never calls suiteStarted / suiteDone, so make a fake one to use
const fakeFocusedSuite = {
id: 'focused',
description: 'focused specs',
fullName: 'focused specs'
};
View mu4e-thread-folding.el
;; Refactored from https://github.com/djcb/mu/pull/783
(defun mu4e~headers-msg-unread-p (msg)
"Check if MSG is unread."
(let ((flags (mu4e-message-field msg :flags)))
(and (member 'unread flags) (not (member 'trashed flags)))))
(defvar mu4e-headers-folding-slug-function
(lambda (headers) (format " (%d)" (length headers)))
@felipeochoa
felipeochoa / DOCX spec.md
Created Mar 8, 2017
Quick overview of how the DOCX format works
View DOCX spec.md

How the DOCX spec works

The standard can be downloaded from the ISO website at [this direct link][iso direct link]

DOCX documents are a zipped folder containing several interacting components in a word doc. The main ones are:

  • word/document.xml: The main document content
  • word/styles.xml: Name style information (e.g. "Header 1"), similar to CSS
You can’t perform that action at this time.