Skip to content

Instantly share code, notes, and snippets.

" Vim Tab Navigation
nmap <Tab> :tabnext <CR>
nmap <s-tab> :tabp <CR>
nmap <C-A> :tabn 1 <CR>
set tabpagemax=100
" Some function keys
nmap <F4> :q<CR>
nmap <F5> :w<CR>
imap <F5> <Esc>:w<CR>
3) `changes` should return a feed:
ReqlRuntimeError: Query terminated by the `rethinkdb.jobs` table in:
r.db("3b3396afa97b9e4e88248305cf9a7437").table("32bf280b44b0aea4f55d0c01b1efd1ff")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.changes()
^^^^^^^^^^
at Connection._processResponse (lib/connection.js:241:21)
at Socket.<anonymous> (lib/connection.js:150:14)
at readableAddChunk (_stream_readable.js:146:16)
'use strict';
var kue = require('kue');
var queue = kue.createQueue({ initialJobId: 10000 });
function createJobs() {
for (var i = 0; i < 101; i++) {
(function() {
var job = queue.create('test', { id: i }).save(function(error) {
#!/usr/bin/env python
# Validate an IP address without using regular expression
def is_valid_ip(ip):
if len(filter(lambda x: x.isdigit() and 0 <= int(x) <= 255, ip.split('.'))) == 4:
return True
return False
# Colored messages on terminal
def red(msg):#{{{
@kulbirsaini
kulbirsaini / devise.rb
Created March 13, 2011 06:43
Devise configuration to allow username or email address for sign_in, confirmation, unlock, forgot password instructions.
################################################################
# For views/migrations etc. check http://tinyurl.com/3xfx3zm #
################################################################
# File : RAILS_APP/config/initializers/devise.rb
# Change the following only. Rest can stay same
# NOTE : You must use devise master or any version released after Mar 13, 2011 to get everything mentioned here working.
config.authentication_keys = [ :login ]
config.confirmation_keys = [ :login ]
config.unlock_keys = [ :login ]
@kulbirsaini
kulbirsaini / auth_helper.rb
Created March 10, 2011 05:51
Using devise sign in, sign up views through your rails app
# File : app/helpers/auth_helper.rb
# include this module in app/controllers/application_controller.rb
# include AuthHelper
# Module to define some functions to use devise views in any
# of your controllers to render sign_in or sign_up pages.
module AuthHelper
# Included for devise_error_messages!
include DeviseHelper