Skip to content

Instantly share code, notes, and snippets.

View mike623's full-sized avatar

404 Not Found mike623

View GitHub Profile
// meteor add iron:router
// https://github.com/EventedMind/iron-router/blob/devel/Guide.md#route-options
Router.route('/post/:_id', {
// The name of the route.
// Used to reference the route in path helpers and to find a default template
// for the route if none is provided in the "template" option. If no name is
// provided, the router guesses a name based on the path '/post/:_id'
name: 'post.show',
@mike623
mike623 / serializeObject.js
Created October 29, 2015 02:42
javascript function for return form input data as object
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
@mike623
mike623 / scss.json
Created October 29, 2015 09:45
fourseven/meteor-scss
{
"useIndex": true,
"indexFilePath":"client/stylesheets/main.scss",
"enableAutoPrefixer": true
}
@mike623
mike623 / class.es6.js
Last active November 16, 2015 16:56 — forked from dferber90/class.es6.js
Class
// ES6
class Tweet {
constructor (doc) {
_.extend(this, doc);
}
}
Tweets = new Mongo.Collection('tweets', {
transform (doc) {
return new Tweet(doc);
@mike623
mike623 / meteor-get-real-ip
Created November 9, 2015 09:11 — forked from iDoMeteor/meteor-get-real-ip
Gets the DDP connections true IP address by analyzing HTTP forwarded count from the Meteor.connection object. Stripped from iDM Connection Log.
Meteor.methods({
// Get the connections *real* IP
getConnectionIP: function () {
// No need to make others wait
this.unblock();
// Locals
var conn = this.connection;
@mike623
mike623 / _wihe.scss
Created November 16, 2015 17:20
set you width, height
@mixin wihe ($width:initial , $height:initial) {
width: $width;
height: $height;
}
@mike623
mike623 / _aspect-ratio.scss
Created November 17, 2015 09:17
Maintain_Aspect_Ratio_Mixin
@mixin aspect-ratio($width, $height) {
position: relative;
&:before {
display: block;
content: "";
width: 100%;
padding-top: ($height / $width) * 100%;
}
> .content {
position: absolute;
<template name="ForgotPassword">
<form action="/forgot" id="forgotPasswordForm" method="post">
<input id="forgotPasswordEmail" type="text" name="email" placeholder="Email Address">
<input class="btn-submit" type="submit" value="Send">
</form>
<!-- end #forgot-password-form -->
</template>
@mike623
mike623 / _clickable.scss
Created November 18, 2015 13:43
make element more clickable
.clickable{
position: relative;
&:after{
position:absolute;
content:'';
top:-10px;
right:-10px;
left:-10px;
bottom:-10px;
}
@mike623
mike623 / Tracker.afterFlush.js
Created November 18, 2015 18:23
Tracker.afterFlush
Another example where you want to initialize a plugin when the subscription is done:
Template.listing.onRendered(function () {
var template = this;
template.subscribe('listOfThings', function () {
// Wait for the data to load using the callback
Tracker.afterFlush(function () {
// Use Tracker.afterFlush to wait for the UI to re-render
// then use highlight.js to highlight a code snippet