Skip to content

Instantly share code, notes, and snippets.

@glucero
glucero / tabline.vim
Created July 15, 2013 18:55
my tab line
function TabLine()
let s = ''
let t = tabpagenr()
let i = 1
while l:i <= tabpagenr('$')
let buflist = tabpagebuflist(l:i)
let winnr = tabpagewinnr(l:i)
let s .= '%' . l:i . 'T'
let s .= (l:i == l:t) ? '%1*' : '%2*'
let s .= '%*'
@glucero
glucero / colormap.rb
Last active December 18, 2015 22:29
terminal colormap
#!/usr/bin/env ruby
def color_map
yield ->(offset) { ->(color) { print "\x1b[48;5;#{color + offset}m " } }
print "\x1b[0m", ?\n
end
puts 'System colors:'
color_map { |color| 8.times &color[0] }
@glucero
glucero / example.coffee
Last active December 16, 2015 01:49
Example Smith Plugin
# Description
# Example Plugin
#
# Commands
# smith example
# smith repeat <words>
# smith roll die
module.exports = (robot) ->
@glucero
glucero / robin.markdown
Last active December 15, 2015 13:09
using the robin to compose clojure map functions to look like ruby map functions

The Robin

λxyz.yzx

Clojure

(fn [x] (fn [y] (fn [z] ((y z) x)))

Because Clojure prefers variadic functions to curried functions, we need to make our own curried-map function

@glucero
glucero / custom_screen_send.vim
Created March 22, 2013 16:26
custom functions for the screen vim plugin
let g:ScreenImpl = 'Tmux'
function! CustomScreenSend()
silent! %s/\s\+$//e
silent! g/^$/d
ScreenSend
silent! normal! ggdG
endfunction
@glucero
glucero / inherit_from.rb
Last active December 14, 2015 23:38
inheriting from a module, method by method
module Kernel
def inherit_from(namespace, **methods)
methods.each do |key, value|
self.send :define_method, value, &namespace.instance_method(key).bind(self)
end
end
end
module Greetings
@glucero
glucero / index.clj
Created March 14, 2013 16:50
simple tabs
(defn build-tab
[index item]
[:li [:a {:href (str "#tab-link-" index)
:data-toggle "tab"} (str (:name item))]])
(defn import-css
[location]
[:link {:type "text/css" :href location :rel "stylesheet"}])
(defn import-js
@glucero
glucero / rtd.rb
Created March 1, 2013 17:33
rtd data models
#!/usr/bin/env ruby
module RTD
module Model
include Enumerable
def all
to_a
module Extendable
def unique_instance_methods
instance_methods.sort - superclass.instance_methods.sort
end
def extend_methods(*methods)
methods.each do |method_extender|
method = instance_method(method_extender)
@ECHO OFF
SET SIZELIMIT=%2
SET FILESIZE=%~z1
SET FILEPATH=%~f1
SET DKEY="OS|Windows|FileSize|%~nx1"
IF %FILESIZE% GTR %SIZELIMIT% (
ECHO %DKEY% %FILESIZE% 2 "%FILEPATH% is greater than %SIZELIMIT%"
) ELSE (