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
function checkStatus(req, res, next) { | |
As.findOne({ email: req.body.email }, function(err, data) { | |
if (err) { | |
return next(err); | |
} else if ( data === null) { | |
return( next() ); | |
} else if ( data.verifyStatus === true ) { | |
res.send('Your account has already been activated. Just head to the login page.'); | |
} else { | |
res.send('An email has been send before, please check your mail to activate your account. Note that you can only get another mail after 1.5h. Thanks!'); |
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
// Usage: | |
// var express = require('express') | |
// require('enableMultipleViewRoots')(express) | |
module.exports = function(express) { | |
var old = express.view.lookup; | |
function lookup(view, options) { | |
// If root is an array of paths, let's try each path until we find the view | |
if (options.root instanceof Array) { |
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
#event loop demystified ruby | |
#Working with network I/O in Ruby is so easy: | |
#https://practicingruby.com/articles/event-loops-demystified | |
require 'socket' | |
# Start a server on port 9234 | |
server = TCPServer.new('0.0.0.0', 9234) | |
# Wait for incoming connections | |
while io = server.accept |
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
class IOLoop | |
# List of streams that this IO loop will handle. | |
attr_reader :streams | |
def initialize | |
@streams = [] | |
end | |
# Low-level API for adding a stream. | |
def <<(stream) |
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
class Manuscript | |
include Mongoid::Document | |
embeds_many :authors | |
field :code, type: String | |
field :title, type: String | |
field :status, type: String | |
field :status_date, type: Date | |
end |
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
###################### | |
MODULES | |
###################### | |
$ModLoad imuxsock | |
$ModLoad imklog | |
###################### | |
Directives | |
###################### |
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
def change(str) | |
alphabet_count = str.downcase.scan(/[a-z]/).count | |
if alphabet_count > 0 | |
ones = "1"*alphabet_count | |
zeroes = 26 | |
ones_zeroes = ones.ljust(zeroes-alphabet_count,'0') | |
else | |
"0"*26 | |
end | |
end |
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
<source> | |
type embedded_elasticsearch | |
</source> | |
<source> | |
type kibana_server | |
bind 0.0.0.0 | |
port 24300 | |
mount /kibana/ | |
access_log_path var/log/kibana/access.log |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: logstash | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time | |
# Description: Enable service provided by daemon. | |
### END INIT INFO |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.require_version ">= 1.5.0" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# All Vagrant configuration is done here. The most common configuration |
OlderNewer