This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
# 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 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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):#{{{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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> |