Skip to content

Instantly share code, notes, and snippets.

" Called with a command and a redirection target
" (see `:help redir` for info on redirection targets)
" Note that since this is executed in function context,
" in order to target a global variable for redirection you must prefix it with `g:`.
" EG call Redir('ls', '=>g:buffer_list')
funct! Redir(command, to)
exec 'redir '.a:to
exec a:command
redir END
endfunct
!function() {
var doc = document,
htm = doc.documentElement,
lct = null, // last click target
nearest = function(elm, tag) {
while (elm && elm.nodeName != tag) {
elm = elm.parentNode;
}
return elm;
};
@arv
arv / node-append.js
Created October 6, 2011 21:56
Node.prototype.append
(function() {
function isNode(value) {
return value instanceof Node;
}
function isAttrObject(value) {
return value != null && typeof value === 'object' && !isNode(value);
}
@shiawuen
shiawuen / index.html
Created December 29, 2011 15:05
Sample to upload file by chunk
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>test upload by chunk</title>
</head>
<body>
<input type="file" id="f" />
<script src="script.js"></script>
@mbbx6spp
mbbx6spp / OTP.md
Created January 10, 2012 03:33
Erlang/OTP Glossary

Erlang/OTP Glossary

I am hoping this will serve as a reference for coworkers and others new to Erlang and OTP to be able to figure out the terminology easier than I had to. I learned the hard way, so you don't have to!:)

  • Erlang/OTP - The set of libraries and conventions that are used as part of the core Erlang distribution by Ericsson to build fault-tolerant, distributed systems more effectively.
  • OTP Release - A fully deployable distribution to run on an "Erlang node" (see below). An OTP Release may have one or more OTP Applications running inside of it at any time.
  • OTP Application - Usually a stateful long-running and active set of Erlang processes that collaborate together to achieve a well-defined set of responsibilities. It is a packaging of these collaborating modules and processes into a directory structure (see 'OTP Application Conventions' below) along with metadata about the OTP Application and default/fallback environment variable values (in case the OTP Release above doe

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 31, 2024 22:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dstokes
dstokes / gist:3651554
Created September 6, 2012 05:13
Tmux Battery Indicator

Battery indicator for the tmux status line (add to ~/.tmux.conf)

Displays the charge percentage and a unicode lightning bolt when the battery is charging. Makes use of the pmset command for battery information.

Tested on MacOSX Mountain Lion

set -g status-right "batt: #(pmset -g batt | awk 'NR==2 {gsub(/;/,\"\"\\); \
 print (match($3,/^ch/\\) ? \"\⚡ \":\"\"\\) $2}') | %h-%d %H:%M "
@ToddG
ToddG / rebar-reltool-relase-notes.md
Created September 15, 2012 16:46
using rebar to create an erlang app with a dependency, and then starting a release created with reltool

Summary

I'm trying to figure out how to use rebar to:

  • create erlang project
  • add a dependency on an erlang module from github
  • start the app via the erl console
  • create a release and start the app from the release (via the generated scripts)
@rzezeski
rzezeski / gist:3941804
Created October 23, 2012 21:42
lmao erlang:decode_packet
17:39:48 <{mochiweb_acceptor,init,3}> {erlang,decode_packet,
[httph,
<<"x-riak-meta-user_s: foo\r\nx-riak-meta-description_t: bar\r\nContent-Length: 153426\r\nExpect: 100-continue\r\n\r\n">>,
[]]}
17:39:48 <{mochiweb_acceptor,init,3}> {erlang,decode_packet,3} -> {ok,
{http_header,
0,
"X-Riak-Meta-User_s",
undefined,