Skip to content

Instantly share code, notes, and snippets.

View handlebars-each-index-key
When looping through items in each, you can optionally reference the current loop index via {{@index}}
{{#each array}}
{{@index}}: {{this}}
{{/each}}
For object iteration, use {{@key}} instead:
{{#each object}}
{{@key}}: {{this}}
@dweldon
dweldon / meteor-nginx
Last active Mar 18, 2021
This is an example of how to configure nginx to serve a meteor app.
View meteor-nginx
server {
listen [::]:80;
listen 80;
server_name app.example.com;
return 301 https://$server_name$request_uri;
}
server {
@gt-gist
gt-gist / client.js
Created Jan 10, 2013
Meteor: autocomplete text by bootstrap typeahead
View client.js
Template.myform.rendered = function () {
return Meteor.defer(function () {
return $('.item-select').typeahead({
source: items
View app.js
if (Meteor.is_client) {
var userName = "PatelNachiket";
Template.hello.greeting = function () {
return "Fetch recent tweets from Twitter stream of user : " ;
};
Template.hello.events = {
'click #fetchButton' : function () {
console.log("Recent tweets from stream!");
$('#fetchButton').attr('disabled','true').val('loading...');
@Yavari
Yavari / README.markdown
Created Feb 23, 2012 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things
View README.markdown

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
      # this function receives the typeahead object and the query string
@zacharydanger
zacharydanger / smtp.rb
Created Feb 9, 2012
Sample Rails ActionMailer config/initializer
View smtp.rb
# this file should be config/initializers/smtp.rb
config_file = File.join(Rails.root.to_s, '/config/smtp.yml')
if File.exists? config_file
if smtp_config = YAML.load_file(File.expand_path(config_file))[Rails.env]
MyApp::Application.config.action_mailer.delivery_method = :smtp
MyApp::Application.config.action_mailer.smtp_settings = smtp_config
end
end