Tuesday, 18 March 2014

Sublime Slack 1.4.0 released


1. File upload

  • current open file

  • right click in sidebar, on file

  • enter file path manually



2. API errors (example: 'invalid_auth') are sent to user with an alert.

Monday, 17 March 2014

Sublime Slack 1.3.3 bugfixes

Fixed some critical bugs:

  • after selecting a receiver from dropdown, sublime does not freeze anymore. Instead, it shows a loader in the status bar while sending the message.

  • fixed multiple teams name duplicate.

Please update by running "Package Control: Upgrade/Overwrite Packages"

Details: https://github.com/simion/sublime-slack-integration

Sunday, 16 March 2014

Sublime Slack 1.3.2 changelog


  • When sending messages from input, the message can begin with @user, #channel or .group to skip channel/user/group selection

  •  New message from input will have autofilled the last @user #channel or .group used (for quick chatting, if you want to keep replying from sublime while you see received messages in chrome notifications)

  • Added some fancy loaders when grabbing data from api (channels/groups/users) and when sending message

Details: https://github.com/simion/sublime-slack-integration

Saturday, 15 March 2014

Sublime Slack 1.3 released


  • support multiple tokens (teams)

  • send private messages to users

  • send messages to groups (private channels)

To update your plugin instantly, run "Package Control: Upgrade/Override all packages".

Details: https://github.com/simion/sublime-slack-integration

Friday, 7 March 2014

Manually generate Django password reset token

Ever needed to manually generate a password reset token?

For example, imagine this situation:
You create a user from a custom form, and you want the user to set his own password.
Solution: generate a password reset token,  email him the link, and let him choose his own password.

Here's how you implement this:
from django.contrib.auth.tokens import default_token_generator
from django.utils.http import urlsafe_base64_encode
from django.utils.encoding import force_bytes

from django.db.models.signals import post_save

post_save.connect(user_saved, User)

def user_saved(sender, instance, created, *args, **kwargs):
if created:
context = {
'token': default_token_generator.make_token(instance),
'uid': urlsafe_base64_encode(force_bytes(instance.pk)),
'user': instance,
# here, send an email with this context

To display the link in the email, you must set the password reset url, and display it:
{% url 'password_reset_confirm' uidb64=uid token=token %}

urlpatterns += patterns(
url(r'^password-change/done/$', 'password_change_done', name='password_change_done'),


Tuesday, 4 March 2014

Deploy with fabric on multiple servers

Ever needed to deploy with fabric on multiple machines?
Here's a simple solution to aproach this issue.

In your fabfile.py , add these two methods:
def live():
env.hosts = [""]
env.user = 'test'
PATH = '/path/to/project'
# optional, is using virtualenv
ENV_PATH = '/path/to/virtualenv'
# overwrite whatever variabled you need to change on the current machine

def staging():
env.hosts = [""]
env.user = 'test2'
PATH = '/path/to/project/on/second/machine'
# optional, is using virtualenv
ENV_PATH = '/path/to/virtualenv'
# overwrite whatever variabled you need to change on the current machine

Now, when deploying, for example:
def deploy():
with cd(PATH), virtualenv(ENV_PATH):
run('uber command')
run('another uber command')

you must use the following commands, in the correct order:
#deploy on staging
fab staging deploy

# deploy on live
fab live deploy

Fabric runs the "staging" or "deploy" commands first, setting the envrinoment variables, and then it runs the "deploy" command doing whatever you asked it to do.