Skip to content

Instantly share code, notes, and snippets.

View gabrielhpugliese's full-sized avatar

Gabriel H Pugliese gabrielhpugliese

View GitHub Profile
@gabrielhpugliese
gabrielhpugliese / logentries.md
Last active August 29, 2015 14:17
Logentries guest post

There are a lot of implicit computation going on with Meteor's reactivity. Tracker, Session variables, Cursors, Templates etc. They create lots of implicit recalculations that we can easily lose their tails and create a seven-headed dragon that will haunt you! For me, the immediate valuable technique is logging everything that is going to recompute on reactive data contexts (see more here: http://docs.meteor.com/#/full/reactivity).

On CodersTV, I'm starting to send my logs to Logentries, from both client and server. It is useful if you don't want to care about log rotation and other hard disk concerns on small machines. Also valuable if you have a balancer with autoscale and need to send logs to the same entry point. Or maybe if you are using meteor.com server, where it is most valuable.

On Meteor's servers, you can access your logs running the command meteor logs .meteor.com, but it will give you only the latest logs and you can't tail it making it a hell to cross old and ne

@gabrielhpugliese
gabrielhpugliese / querydict.py
Created March 26, 2015 14:41
QueryDict with lists
In [23]: query_string = u'fields%5Bcategories%5D%5B%5D=1&fields%5Bcategories%5D%5B%5D=3'
In [24]: QueryDict(query_string)
Out[24]: <QueryDict: {u'fields[categories][]': [u'1', u'3']}>
In [25]: QueryDict(query_string).dict()
Out[25]: {u'fields[categories][]': u'3'}
In [26]: QueryDict(query_string).items()
Out[26]: [(u'fields[categories][]', u'3')]
<VirtualHost *:80>
ServerName server_name
ServerAdmin administrador@ehnoiz.com.br
AssignUserID user_name user_name
#DocumentRoot "/home/user_name/site_env/web_app/user_name/public/"
#<Directory />
# Options FollowSymLinks
# AllowOverride None
@gabrielhpugliese
gabrielhpugliese / gist:3210236
Created July 30, 2012 21:05
nginx wordpress config
server{
listen 80; #or change this to your public IP address eg 1.1.1.1:80
server_name www.blogcloud.com.br; #change this to the domain name, for example www.myblog.com
access_log /var/log/wordpress.access_log;
error_log /var/log/wordpress.error_log;
location / {
root /home/wordpress/public_html/wordpress;
index index.php;
class Ze():
attr1 = 'viadinho'
def __init__(self):
# Isso e um construtor
self.attr2 = 'gayzola'
def canta_hino(self, time='palmeiras'):
if(time == 'palmeiras'):
return 'Quando surge...'
return 'Nem'
@gabrielhpugliese
gabrielhpugliese / gist:3725414
Created September 14, 2012 22:40
Meteor unload
window.onbeforeunload = function(e) {
var message = "Your confirmation message goes here.";
var name = Session.get('name');
Name.remove(nome);
Meteor.flush();
return message;
};
Nomes = new Meteor.Collection("nomes");
Nome = {
remove : function(nome) {
return Nomes.remove({
nome : nome
});
},
get : function(nome) {
return Nomes.findOne({
@gabrielhpugliese
gabrielhpugliese / gist:3735085
Created September 17, 2012 01:16
Meteor method is not working
Nomes = new Meteor.Collection("nomes");
Nome = {
remove : function(nome) {
return Nomes.remove({
nome : nome
});
},
get : function(nome) {
return Nomes.findOne({
@gabrielhpugliese
gabrielhpugliese / gist:3763872
Created September 21, 2012 21:02
onbeforeunload meteor
Names = new Meteor.Collection("names");
Name = {
remove : function(name, room) {
return Names.remove({
name : name,
room : room,
host : PARENT // It's a string
});
},
get : function(name, room) {
@gabrielhpugliese
gabrielhpugliese / gist:3929083
Created October 22, 2012 00:34
Facebook trouble
Template.body.connected = function(){
return Meteor.userLoaded();
};
Template.body.have_game = function(){
//get into game ...
}
Template.index.created = function(){
//list facebook friends