Since there is not much documentation on this yet, here are some notes:
OS/X HINT: use absolute filenames for input, otherwise the project file will be found but not the referenced files
Fileformat:
| var p = new Promise( function(resolve,reject){ | |
| resolve(374); | |
| }); | |
| p.then(function fulfilled(message){ | |
| foo.bar(); | |
| console.log(message); // never reached | |
| }, | |
| function rejected(err){ | |
| // never reached |
| "Vundle Setup | |
| filetype off | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| Plugin 'christoomey/vim-tmux-navigator' | |
| call vundle#end() | |
| filetype plugin indent on | |
| set autoread | |
| """"""""""""""""""""" |
In a recent discussion I had with a friend about Haskell and Scala, they brought up the fact that they sometimes miss Scala's partial functions. In Scala, these are a trait of their own somewhat different from what Haskellers usually understand by "partial function". In particular, you can check if a value is in the domain of the partial function before applying it to the function.
Interestingly enough, partial functions are also supported in Haskell - they just happen to be hidden away in some more obscure parts of the base library. What follows is my attempt to make a module that brings this functionality out and makes it more accessible. Since this is meant to be a literate Haskell source, let's start with some preamble.
{-# LANGUAGE TypeOperators, NoImplicitPrelude, GeneralizedNewtypeDeriving #-}
module Data.Function.Partial where
import Prelude hiding (id, (.), ($))| -- Copyright 2006-2015 Mitchell mitchell.att.foicica.com. See LICENSE. | |
| -- HAML LPeg lexer. | |
| local l = require('lexer') | |
| local token, word_match = l.token, l.word_match | |
| local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V | |
| local M = {_NAME = 'haml'} | |
| -- Whitespace. |
| # DATA PROVIDED TO US. STRUCTURE CANNOT BE MODIFIED! WELCOME TO THE REAL WORLD PRINCESS | |
| sizes = [ | |
| { | |
| "name": "item_1", | |
| "size_in_mL": "100mL", | |
| "alternate_identifier": "axc45" | |
| }, | |
| { | |
| "name": "item_2", |
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb
| const insert = (fn = (a, b) => a < b, item, list = []) => { | |
| if (!list.length) { | |
| return [item]; | |
| } | |
| if (list.length === 1) { | |
| return fn(item, list[0]) ? [item, list[0]] : [list[0], item]; | |
| } | |
| let min = 0; | |
| let max = list.length - 1; | |
| while (true) { |
| /** | |
| * Lightweight script to detect whether the browser is running in Private mode. | |
| * @returns {Promise<boolean>} | |
| * | |
| * Live demo: | |
| * @see https://output.jsbin.com/tazuwif | |
| * | |
| * This snippet uses Promises. If you want to run it in old browsers, polyfill it: | |
| * @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js | |
| * |
| # -*- encoding: utf-8 -*- | |
| import sublime | |
| import sublime_plugin | |
| class MinimapSetting(sublime_plugin.EventListener): | |
| def on_activated(self, view): | |
| show_minimap = view.settings().get('show_minimap') | |
| if show_minimap: |