Skip to content

Instantly share code, notes, and snippets.

val kafka = new ReactiveKafka()
val consumerProperties = toConsumerProperties(config, new MyDecoder())
val publisher = kafka.consume(consumerProperties)
Source(publisher)
.map { ...
.runForeach(_ => ())
val publisher2 = kafka.consume(consumerProperties)
@note
note / gist:5668994
Created May 29, 2013 09:10
facebook WTF
run.sh
connect hr/hr;
set echo on
BEGIN
FOR i IN 1..50 LOOP
execute immediate 'select * from hr.employees where employee_id = 115';
END LOOP;
END;
/
def findByEmail(email: String): Option[NativeUser] = {
DB.withConnection{ implicit connection =>
SQL("SELECT id, firstName, lastName, email, password, hasAvatar FROM appUser WHERE email={email}").on('email -> email)().collectFirst {
case Row(id: Long, firstName: String, lastName: String, email: String, password: String, hasAvatar: Boolean) => NativeUser(anorm.Id(id), firstName, lastName, email, password, hasAvatar)
}
}
}
function validateLogin(input){
if(input.val().length < 1){
addMessage(input.parent(), 'Please provide login');
return false;
}
if(!input.val().match(/^[a-zA-Z0-9_-]+$/)){
addMessage(input.parent(), 'Provided login contains invalid characters (letters, numbers, hyphen and underscore allowed)');
return false;
}
$.get("isLoginAvailable/" + $("#login").val(), function(data){
function validateLogin(input){
if(input.val().length < 1){
addMessage(input.parent(), 'Please provide login');
return false;
}
if(!input.val().match(/^[a-zA-Z0-9_-]+$/)){
addMessage(input.parent(), 'Provided login contains invalid characters (letters, numbers, hyphen and underscore allowed)');
return false;
}
$.get("isLoginAvailable/" + $("#login").val(), function(data){
michal@debian~/Desktop/programming/node.js/simple-bookmarks [master]$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# decorator.js
# dokumentacja/analiza.systemu.aux
# dokumentacja/biblio.aux
# dokumentacja/index.aux
# dokumentacja/index.out
node-example@0.0.1 /home/michal/Desktop/programming/node.js/simple-bookmarks
├─┬ connect-form@0.2.1
│ └── formidable@1.0.9
├─┬ connect-redis@1.3.0
│ └── debug@0.6.0
├── UNMET DEPENDENCY crypto >= 0.0.3
├─┬ express@2.5.8
│ ├─┬ connect@1.8.5
│ │ └── formidable@1.0.9
│ ├── mime@1.2.4
@note
note / gist:2295859
Created April 3, 2012 22:15
various
exports.processLogin = function (req, res){
var User = mongoose.model('Users');
var id;
var u = User.where('login', req.body.login).find({}, function(err, docs){
req.session.userId = docs[0]._id;
User.where('login', req.body.login).where('password', models.createHash(req.body.password)).count(function(err, count){
if(err || count == 0)
res.render('login', {title: 'log in'});
else{
req.session.loggedIn = true;
/**
* Zwalnia wszyskie bloki pamieci oraz sama liste.
*/
void dispose_list(struct list * l){
struct block * it = l->first, *tmp;
while(it != NULL){
tmp = it->next;
delete_block(it, l);
it = tmp;
}