2016-03-24

Meteor - How to make server-side comments on HTML files (spacebars comments)

{{! This is a comment on your source code, that won't be displayed to the client }}

2016-03-17

Meteor - How to supress invalid characters entered in a textbox (Meteor event/jQuery)

"keyup .CLASS_OR_JQUERY_SELECTOR": function( evt ){

  evt.currentTarget.value =
    evt.currentTarget.value.replace(
      /[^a-zA-Z0-9]/g      , function(str) {
        console.log( 'Illegal character typed: [" ' + str + '].' );        return '';      }//function    )//replace  ;//value
}//keyup

2016-03-14

jQuery - How to filter an array of json objects

$.grep(
    ARRAY_OF_OBJECTS
    , function(obj) {
        return(
            obj.OBJECT_KEY_1 === SOUGHT_VALUE_1
            && obj.OBJECT_KEY_2 === SOUGHT_VALUE_2
        );
    }
).length;

PS. Add the .length property call if you just want to know how many sub-objects matched your query.

MongoDB - How to shutdown the server using a query statement

mongo
use admin
db.shutdownServer()

2016-03-13

Meteor - Path to the MongoDB executable in OSX

/Users/USER_NAME_HERE/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/mongodb/bin/mongo

PS. This will of course depend on your version of Meteor (1.2.1 in this case) and OSX (10.11 in this case).

2016-03-12

Twitter Bootstrap - How to bind a tooltip nature to programmatically generated tooltip elements

$(document).ready(function(){

  // Bind bootstrap tooltips 
  $('body').tooltip({
    selector: '[rel=tooltip]'     
    , delay: {
      show: 50 
      , hide: 250     
    }
  });
});
 


This will bind static or dynamically generated items that contain a "rel" attribute with a "tooltip" value. 
This is an example, with a few extra options to consider.
 
 
  rel="tooltip"   
  data-original-title="This is the tooltip's main content, the text to display." 
  data-placement="top"   
  animation="true" 
  trigger="hover focus"   
  delay="0"   
>

2016-03-11

CSS - FortAwesome CheatSheet

FortAwesome.com offers a hosted custom package with a set of icons of your choice. You select your icons, publish it as a "kit", and then you get a CDN to add as a .js script to your site.

This is a cheat sheet illustrating some of the options you have... from displaying a simple icon, to enlarging, rotating and animating.

This assumes you have pre-fixed your icons with the default "fa" style, and also icon name prefix.

Basic: 
    flag
">

Larger:
    33% increase: fa-lg">
    Xx increase:  fa-2x">

Fixed width:
    fa-fw">

List icons:
   
    fa-ul
">
       
  • fa-li
  • fa fa-check-square">List icons
           
  • can be used

  •        
  • as bullets

  •        
  • in lists

  •    

    Bordered and pulled:
        fa-3x    pull-left    fa-border">

    Animated:
       

    Rotated and flipped:
        fa-rotate-90"> fa-rotate-90
        fa-rotate-180"> fa-rotate-180
        fa-rotate-270"> fa-rotate-270
        fa-flip-horizontal"> fa-flip-horizontal
        fa-flip-vertical"> fa-flip-vertical

    Stacked (twitter on a square):
        fa-stack fa-lg">
            fa-stack-2x">
            fa-stack-1x">
       

    PS. You can do some, only some of these things, with Twitter's Bootstrap (as of 3.3.6).

    jQuery - Element selection based on class and custom attribute value

     $(".CLASS_NAME[ ATTRIBUTE_NAME = 'ATTRIBUTE_VALUE' ]")...

    2016-03-09

    Meteor - Return your identity (whoami) and/or login to the correct meteor/galaxy account

    meteor whoami
    meteor login

    Paste these into a terminal window.
    This is important so that you deploy to your desired meteor/galaxy account.


    2016-03-05

    Meteor - MongoDB collection direct list of records

    Meteor.PUBLICATION-NAME.find({QUERY-HERE}).collection._docs._map;

    Paste this in the console to get the list of published users.
    Meteor.users.find().collection._docs._map;