Open devtools Select Profiles Select Collect JavaScript CPU Profile Click Start Do the (typically slow) things you wish to record Click Stop You now got a table of functions, and CPU time they consumed. On the right hand side of the table, you got a link to the js file and its line number of the function that is…

Here is a great talk about them Chrome tools. You can emulate reduced network speed You can emulate other device You can force states (:active etc) for elements You can smartprint objects You can group console logging You can time sections of the code or timestamp all logging You can insert debugger stops debugger; You can…

Sending SMS using twilio.com is nice, but it also costs money. If you want something free that you can use for your hobby projects, check out pushbullet.com. If you sign up (it’s free), you can push SMS with the following: Sign up at pushbullet.com Get the app Install pushbullet with pip: pip install pushbullet.py Find your API key here…

Here’s a simple step by step guide on how to create a s3 bucket, with an attached cloudfront and a user with write access. This is typically what you want if you need quick hosting for static files for you website. This is made in contrast to the terraform guide, which does the same, but using different tools If…

Case: You want efficient collectstatic and serving of files You want static files and media files to be hosted on an AWS S3 bucket. (optional) You have too many files for “normal” collectstatic to be efficient. (optional) You have a non-US S3 bucket. (optional) You use Heroku Disclaimer: Have not tested with python 2.7, can’t…

Edit: I was going to make the s3 bucket with cloudfront, but Terraform has no native support for it, though it looks like it’s coming soon. I’ll probably make a followup later. Edit 2: I made a followup on how to do it with Cloudfront A concrete, developer friendly guide on how to create a proper s3 bucket with…

I changed the MEDIA_URL and STATIC_URL, but wanted the previously used urls “/media/” and “/static/” to rewrite to the new url. It would better be done via your DNS settings, or with an .htaccess file, but can also be done via urls.py if your circumstances don’t allow the other two. from django.conf import settings from django.views.generic.base import RedirectView […] if settings.MEDIA_URL…

I was looking for WEB_CONCURRENCY environment variable on my Django-app. This is used for the number of concurrent webworkers for gunicorn, and is automatically scaled depending on the memory usage of your app. Do it with the toolbelt, and command heroku run printenv –app your-app-name | grep WEB_CONCURRENCY Read more on optimizing your app here

Monitor-driven or Metric-driven development (MDD). It’s becoming more and more relevant parallell with continuous delivery, devops etc, and I think it’s super awesome. Stop finding bugs. Instead, log properly, and monitor where and in what situations error logs are being created. Has there been a sudden increase in a certain type of errors? Get told! Stop checking if…

People still call presentations or slides for powerpoints. That’s kind of funny. This could be an anecdote about that, but it’s not. I’m about to make some slides, and I wonder what applications to use. So here’s some notes instead. I googled around, and liked these two: https://slides.com/ http://lab.hakim.se/reveal-js/#/ The first is really the visual editor implementation of the…

Parallax is hot. But in so many implementations, it’s not. Because it’s implemented shittily. Parallax shouldn’t be done with Javascript, because then it might end up like this: so laggy it breaks my heart. It should be done with CSS. Jsfiddle

Sometimes I clone a repository with Django and make a setup of the environment on my own machine. Then I would usually like to have some testdata populated in my environment. So here’s how to copy the data from one Django installation (production) to my environment (test). 1. ssh to the remote server ssh username@hostname 2. Navigate to the folder…

I’ve been working a bit with automatic emails, newsletter etc. lately. And if there’s one thing I have to say, it would be: FUCK OUTLOOK. I’ve spent so much time doing stupid style changes for an html email to look nice in Outlook 2011, Outlook Web App and Outlook 2013. It’s like they render html mails with three completely different…

It has happened on more than one occasion that I want a new Django project, with Grunt, jQuery, Bootstrap, Font-Awesome etc, deployed on Heroku. So I decided to write down the steps, and made a bash script to automate it all for me.

Edit: Stop what your doing. It’s hurting, I know. Go read The Easy Way of Sending Newsletter Emails. Outlook Web App is horrible. https://litmus.com/community/discussions/1354-email-content-and-table-centering Lead me to write <html> <body> <table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″><tr><td align=”center”> <!– This is your container, you can shrink this if you want, but it’s not recommended to go over…

I’m new to the whole Bluetooth communication game, but in my case I’ve run into having to communicate using 8-bit usigned integer arrays (I’ve used Cordova libraries to communicate with Arduino chips). In order to do this I’ve had to convert from and to JSON structures on the Cordova side. I’ve done this with the…

I recently bought a Macbook Pro Retina (Late 2014) with 128 GB of storage. I thought that if I needed 256 GB, I could just buy a regular SSD and swap them. Turns out i can’t. Or.. I can, but it’s a special SSD that costs a third of a new Mac. And I just…

This little JavaScript snippet lets you easily decide (from another javascript function) to show a confirm-dialog (Bootstrap), and functions to be executed on cancel/confirm. Check it out at https://gist.github.com/tomfa/12bf7651d6a346eb2942 Want one made for submit-buttons, link etc? See http://www.petefreitag.com/item/809.cfm