View demo.vim
" http://andrewvos.com/writing-async-jobs-in-vim-8
function! BackgroundCommandClose(channel)
execute "cfile! " . g:backgroundCommandOutput
copen
unlet g:backgroundCommandOutput
endfunction
function! RunBackgroundCommand(command)
if !exists('g:backgroundCommandOutput')
View gist:8dc54cbc95ded2b52a61bf9405b2d52b
git clone git@github.com:vim/vim.git ~/vim
sudo apt-get remove vim
cd ~/vim
sudo make distclean
./configure --with-features=huge\
--enable-multibyte\
--enable-rubyinterp=yes
--enable-pythoninterp=yes
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu #non-standard!
--enable-python3interp=yes
View list-comprehension-equivalent.js
// equivalent haskell using list comprehension syntax
// [x^2 | x <- [1..10], rem x 2 == 0]
var list = [];
// no ranges ...
for (var i = 1; i < 11; i += 1) {
list.push(i);
}
View sticky_grid.rb
board = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
while (input = gets.chomp.to_i) != "exit"
board = board.map.with_index do |row, i|
row.map.with_index do |column, ii|
if column == input
"x"
View bind-confusion.hs
-- (>>=) :: Monad m => m a -> (a -> m b) -> m b
-- why are `a` and `b` different? i guess that signature means
-- they _can_ be but don't _need_ to be.
Just 5 >>= (\a -> Just (10 + a)) -- Just 15
View fizzbuzz.js
var ns = [];
for (var i = 0; i <= 100; i += 1) { ns.push(i); }
var fizzes = ns.map(function (member) {
if (member % 15 === 0) {
return 'fizzbuzz';
} else if (member % 3 === 0) {
return 'fizz';
} else if (member % 5 === 0) {
return 'buzz';
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style>
* {
box-sizing: border-box;
}
View regex-query.sql
-- http://www.petefreitag.com/cheatsheets/postgresql/
SELECT column FROM table WHERE column ~ 'foo.*';
View doseq-with-index.clj
;; https://groups.google.com/d/msg/clojure/cBCf_ftFSw4/xBG_SfMeMBAJ
(doseq [[idx item] (map-indexed vector a-lazy-seq)]
(do-stuff! item idx))
View populate.sh
#!/bin/bash
x=1
while [ $x -le 22222 ]
do
echo "log entry: $x" >> example.log
x=$(( $x + 1 ))
done