Skip to content

Instantly share code, notes, and snippets.

View NV's full-sized avatar

Nikita Vasilyev NV

View GitHub Profile
@NV
NV / README.md
Created February 22, 2010 19:53
DOM navigator.mimeTypes WTF
@NV
NV / README.md
Created February 23, 2010 20:51
CSS hot reloading
@NV
NV / .bashrc
Created March 14, 2010 21:51
dotfiles: .zshrc .bashrc .vimrc
# /usr/local ➤ ls
PS1="\[\e[0;33m\]\W ➤ \[\e[0m\]"
# http://github.com/mbrubeck/compleat
source /usr/local/share/compleat-1.0/compleat_setup
@NV
NV / file_join_shortcut.rb
Created March 15, 2010 21:57
Shortcut for File.join
class String
# Shortcut for File.join
# Usage
# '..'/'foo' -> '../foo'
def /(path)
File.join(self, path.to_s)
end
end
@NV
NV / README.md
Created March 18, 2010 14:14
UserScript. Replace tabs with 2 spaces

Tab size UserJS

8 spaces for the tab character is too many. I'd prefer 2.

Supported browsers: Firefox, Google Chrome, Opera, and Safari.

beforeafter
@NV
NV / anonymous_class.rb
Created March 21, 2010 13:07
Ruby's anonymous classes
dog = 'Bob'
class << dog
def what
self
end
end
dog.what #'Bob'
''.what #NoMethodError
@NV
NV / README.md
Created March 24, 2010 19:31
XRefresh for Chrome

XRefresh for Chrome

Deprecated! Use LiveReload instead.

via xrefresh#17

How to use

  • ruby ws_dir_watcher.rb ~/my_site
  • Open chrome://extensions/
  • "Developer mode", then press "Load unpacked extension" button
@NV
NV / Google search domains
Created April 2, 2010 20:55
All checked manually
google.ac
google.ae
google.af
google.ag
google.am
google.com.ar
google.as
google.at
google.com.au
google.az
@NV
NV / queue.js
Created April 12, 2010 00:14
queue(a, b, c)(arg) === c(b(a(arg)))
function queue(){
function runQueue(){
var result = arguments;
var args = runQueue.args;
for (var i=0; i<args.length; i++) {
result = [args[i].apply(this, result)];
}
return result[0];
}
runQueue.args = arguments;
@NV
NV / chain.js
Created April 12, 2010 02:19
JavaScript chaining
function chain(fn){
// Chain factory
var list = [fn];
return function oneChain(fn){
if (arguments.length) {
list.push(fn);
return oneChain;
} else {
var result;
while (list.length) {