Skip to content

Instantly share code, notes, and snippets.

View sas1ni69's full-sized avatar

Hassanin Ahmed sas1ni69

View GitHub Profile
call plug#begin('~/.vim/plugged')
Plug 'kchmck/vim-coffee-script'
Plug 'kien/ctrlp.vim'
Plug 'rking/ag.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'slim-template/vim-slim'
Plug 'thoughtbot/vim-rspec'
Plug 'tpope/vim-fugitive'
Books = new Mongo.Collection('books');
if (Meteor.isClient) {
Template.books.helpers({
books: function(){
var filter = Session.get('filter');
return Books.find({ title: new RegExp(filter, 'i') });
}
});
#books-container{
padding-top: 24px;
padding-bottom: 24px;
}
.thumbnail {
margin-bottom:7px;
border: 0px;
}
<template name="book">
<div class="col-md-2">
<div class="thumbnail">
<img class="image-responsive" src="http://lorempixel.com/128/191/" />
<div class="caption text-center">
<b><a href="#">{{title}}</a></b>
<p>by {{author}}</p>
</div>
</div>
</div>
<template name="books">
<div class="container" id="books-container">
{{#each books}}
{{> book }}
{{/each}}
</div>
</template>
db.books.insert([{title: 'The Hunger Games', author: 'Suzanne Collins'},
{title: 'Harry Potter and the Order of the Phoenix', author: 'J.K. Rowling'},
{title: 'To Kill a Mockingbird', author: 'Harper Lee'},
{title: 'Pride and Prejudice', author: 'Jane Austen'},
{title: 'Gone with the Wind', author: 'Margaret Mitchell'},
{title: 'The Chronicles of Narnia', author: 'C.S. Lewis'},
{title: 'Animal Farm' , author: 'George Orwell'},
{title: 'The Giving Tree The Giving Tree', author: 'Shel Silverstein'},
{title: 'The Hitchhikers Guide to the Galaxy', author: 'Douglas Adams'}]);
$ meteor mongo
$ db.books.find();
$ db.books.insert({title: 'Children of Hurin', author: 'J.R.R. Tolkien'});
$ db.books.find();
Books = new Mongo.Collection('books');
if (Meteor.isClient) {
Template.books.helpers({
books: function(){
return Books.find();
}
});
}
<template name="books">
{{#each books}}
{{title}} - {{author}}
{{/each}}
</template>
<template name="searchbar">
<form role="form">
<div class="container">
<div class="col-xs-12">
<div class="input-group input-group-md">
<input type="text" class="form-control" placeholder="Search by title, author or ISBN" />
<div class="input-group-btn">
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-search"> Search</span></button>
</div>
</div>