Skip to content

Instantly share code, notes, and snippets.

View gabrielhpugliese's full-sized avatar

Gabriel H Pugliese gabrielhpugliese

View GitHub Profile
Template.main.rendered = function () {
var self = this;
_.defer(function () {
self.$('div').plugin();
});
};
// ou tenta isso:
Template.main.rendered = function () {
@gabrielhpugliese
gabrielhpugliese / app.js
Last active August 29, 2015 14:05
Trying to find a good way to append Blaze templates to custom divs
$(function() {
$.each(Template, function (name, tmpl) {
if (name.indexOf('__') === -1) {
UI.insert(UI.render(tmpl), $('#' + name + '-spacebars').get(0));
}
});
});
Books = new Meteor.Collection("books", {
schema: {
title: {
type: String,
label: "Title",
max: 200
},
author: {
type: String,
label: "Author",
// COMO VC TEM Q FAZER:
Meteor.users.find().forEach(function (doc) {
if (doc.profile && doc.profile.phoneNumber) {
timmy++;
} else if (doc.profile && doc.profile.postCode && doc.stripe) {
kenny++;
}
});
/*****************************************************************************/
<script type="text/javascript">
//<![CDATA[[
$SA = {s:204243, asynch: 1};
(function() {
var sa = document.createElement("script");
sa.type = "text/javascript";
sa.async = true;
sa.src = ("https:" == document.location.protocol ? "https://" + $SA.s + ".sa" : "http://" + $SA.s + ".a") + ".siteapps.com/" + $SA.s + ".js";
var t = document.getElementsByTagName("script")[0];
t.parentNode.insertBefore(sa, t);
HelpRequests = new Meteor.Collection('helpRequests', {
transform: function (doc) {
doc.isCancelled = function () {
return _.contains(['cancel-requester', 'cancel-helper'], this.status);
}
return doc;
}
});
@gabrielhpugliese
gabrielhpugliese / tracking.js
Last active August 29, 2015 13:56
Change preventTracking function to match your requirements of dev env
trackWoopra = function (name, options) {
// woopra
var user = Meteor.user(),
identification = {};
if (Meteor.user()) {
identification = {
name: user.profile.name,
email: user._id
};
@gabrielhpugliese
gabrielhpugliese / sort.py
Created January 15, 2014 17:38
python sorts
def selection_sort(arr):
i = 0
j = 0
while i < len(arr) - 1:
j = i + 1
while j < len(arr):
if arr[i] > arr[j]:
arr[i], arr[j] = arr[j], arr[i]
j += 1
i += 1
@gabrielhpugliese
gabrielhpugliese / coderstv-router.js
Created November 8, 2013 14:21
Iron-router for http://coderstv.com with tracking - something may be missing because it's coderstv internals
Router.map(function () {
this.route('index', {
controller: 'BasicController',
layoutTemplate: 'indexLayout',
path: '/',
waitOn: function () {
return Meteor.subscribe('Channels');
}
});
>>> import gc
>>> gc.isenabled()
True
>>> gc.get_count()
(411, 8, 0)
>>> def a():
... import functools
... return
...
>>> gc.get_count()