Skip to content

Instantly share code, notes, and snippets.

@t9md
t9md / decaffenate.sh
Created June 15, 2017 02:08
decaffenate CoffeeScript
#!/bin/bash
# --safe-import-function-identifiers AtomScan\
decaffeinate\
--keep-commonjs\
--prefer-const\
--loose-for-of\
--loose-for-expressions\
--loose-includes\
--loose-default-params\
--allow-invalid-constructors $1
@t9md
t9md / init.coffee
Last active June 4, 2017 15:18
hydrogen-helpers
hydrogenAppendCell = (editor) ->
scope = editor.getLastCursor().getScopeDescriptor()
{commentStartString} = editor.getCommentStrings(scope)
[startRow, endRow] = editor.getLastSelection().getBufferRowRange()
pattern = ///\s*#{commentStartString}\s*%%\s*$///
for row in [startRow..endRow]
scanRange = editor.bufferRangeForBufferRow(row)
replaced = false
validateScrollTop = (editorElement, msg) ->
value1 = editorElement.getScrollTop()
value2 = editorElement.component.getScrollTop()
console.log msg, [value1, value2]
unless value2?
throw Error(msg)
@t9md
t9md / init.coffee
Created May 16, 2017 16:40
atom-narrow start-search-by-double-click
startNarrow = (element, event) ->
{detail, shiftKey, metaKey, ctrlKey} = event
# console.log [shiftKey, metaKey, ctrlKey]
if detail is 2
# if detail is 2 # double-click
event.stopPropagation()
event.preventDefault()
if atom.workspace.getElement().classList.contains('has-narrow')
command = 'narrow:query-current-word'
else
console.log '1. some', [].some(-> true)
console.log '2. some', [].some(-> false)
console.log '3. some', [].some(-> throw Error())
console.log '------'
console.log '1. every', [].every(-> true)
console.log '2. every', [].every(-> false)
console.log '3. every', [].every(-> throw Error())
# 1. some false
# 2. some false

Setup

cd ~/github
git clone https://github.com/t9md/command-palette
cd command-palette
git co add-max-results-option
apm install
apm link -d .
Here is output when I checked command-palette item collection and rendering time by inserting console.time in command-palette code.
### numOfCommands: 418(vmp-disabled)
collect: 14.514ms
render: 48.706ms
collect: 12.533ms
render: 41.355ms
" Surely not work as-is in your environment.
" Since this is my specific configuration
" The purpose for this file put here is how you how you can
"
" - customize color within parts
" - how to use hook
"
let g:ezbar_enable_default_config = 0
@t9md
t9md / test.spec
Created April 17, 2017 08:53
vim-load-time-with-editor
vmpFiles = [
"base.coffee"
"input.coffee"
"occurrence-manager.coffee"
"search-input.coffee"
"blockwise-selection.coffee"
"introspection.coffee"
"operation-stack.coffee"
"search-model.coffee"
"cursor-style-manager.coffee"
@t9md
t9md / config.cson
Created April 12, 2017 04:30
atom-font
fontFamily: "Ricty"
fontFamily: "Iosevka-Light"
fontFamily: "FiraCode-Retina"