Skip to content

Instantly share code, notes, and snippets.

💭
For hire

Chris paxperscientiam

💭
For hire
Block or report user

Report or block paxperscientiam

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
View moose-tooltip.scss
@mixin moose-tooltip($message) {
position: relative;
display: inline-block;
text-decoration: underline dotted blue;
&::before {
opacity: 0;
}
&:hover::before {
opacity: 1;
font-size: 0.8rem;
@paxperscientiam
paxperscientiam / promises.md
Created May 24, 2019 — forked from domenic/promises.md
You're Missing the Point of Promises
View promises.md

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
View moose-functions.el
(defun dsedivec/called-via-key-binding (cmd)
"Returns non-nil if `this-command-keys' is bound to CMD."
(eq (key-binding (this-command-keys)) cmd))
(defun moose/popup-count-words-region (start end)
"Get word count for positive length active region."
(interactive "r")
(cond ((and (use-region-p)
(dsedivec/called-via-key-binding #'moose/popup-count-words-region))
View moost-test.el
(defun moose/popup-count-words-region (start end &optional args)
"Get word count for positive length active region."
(interactive "r\np")
(cond ((and (use-region-p)
(eq this-command 'moose/popup-count-words-region))
(let ((print-escape-newlines t))
(popup-tip (concat (number-to-string (count-words start end)) " words"))))))
View moost-test.el
(defun moose/popup-count-words-region (start end)
"Get word count for positive length active region."
(interactive "r")
(cond ((and (use-region-p)
(> (region-end) (region-beginning))
(eq this-command 'moose/popup-count-words-region))
(let ((print-escape-newlines t))
(popup-tip (concat (number-to-string (count-words start end)) " words"))))))
View compile-make.el
;; all credit to someone else. use are your own peril!
;; search the closest Makefile and run make
;; not finished
;; 从当前目录向上查找最近的Makefile,并执行make命令
(defun get-parent-directory (path)
"get the parent directory"
(file-name-directory (directory-file-name path)))
View moose-functions.el
(defun moose/test-compilation-buffer (buffer string)
"Return messages of success."
(if (and
(string-match "compilation" (buffer-name buffer))
(string-match "finished" string)
(not (search-forward "warning" nil t)))
(message "Compilation successful.")
(message "FAIL!")))
View compile-make.el
;; all credit to someone else. use are your own peril!
;; search the closest Makefile and run make
;; 从当前目录向上查找最近的Makefile,并执行make命令
(defun get-parent-directory (path)
"get the parent directory"
(file-name-directory (directory-file-name path)))
(defun compile-make-ex (target)
View svg2icons.sh
#!/usr/bin/env bash
function finish {
echo "I am complete."
}
trap finish EXIT
function rekt {
echo "Canceled."
exit
}
trap rekt SIGINT
View svg2icons.sh
#!/usr/bin/env bash
function finish {
echo "I am complete."
}
trap finish EXIT
function rekt {
echo "Canceled."
exit
}
trap rekt SIGINT
You can’t perform that action at this time.