Mostrando entradas con la etiqueta tricks. Mostrar todas las entradas
Mostrando entradas con la etiqueta tricks. Mostrar todas las entradas

8 de febrero de 2017

Advanced AJAX / REST debugging tricks


When you are debugging or working with API interactions, you may find yourself making and monitoring a bunch of request from the browser console.

Like this:


You may've noticed the blue line there (plus the url). First trick :)

To get a line like this for every request the site you are looking / debugging performs, as well as one for every AJAX request you make "by hand" (usually, those requests don't get logged by the browser, not they appear on the Network or Timeline tabs), right click on the console and click the "Log XMLHttpRequests" option:




Good one, yet nothing too crazy. Right?

Well, here's where the plot thickens:

Now that you can get all and every each of the requests logged, let's try clicking on the url on the right-side of the blue text and see where it gets us:


Network activity! Things look promising. Ours is the last one. (here comes the second trick).

Let's right-click the last line -> Copy -> Copy as cURL:


Getting and idea of where this is going? :)

Let's now open Postman:

Import -> Paste raw text, paste:


Click import and now you have the request the site (or you) made, exported and put together in Postman, all bit and pieces included (yep, all headers too):



Neat, right? :)


I found this extremely useful when debugging API interactions and request to and from 3rd party sites with unclear APIs (or not APIs at all). Also very useful to simulate form posting from scripts.


Cheers!


26 de septiembre de 2014

Get file extension from filename with Python


Several times I had to put some code together some Python code to get the extension from a filename.

It was required for it to work OK with complex extensions, like ".tar.gz", and remain functional when you have dots in the filename, like in this case: "some.filename.1.v2.tar.gz".

After trying several options, the one that did the trick was using regular expressions, wrapped in a little function.

Here the case for keeping the ".", and getting the extension in the fashion ".tar.gz" or ".png":



Here the case for not keeping the ".", and getting the extension in the fashion "tar.gz" or "png":




Et voilà! :D

25 de septiembre de 2013

Nice app for Mac OS X

Aloha!

I came across this app, that is very useful for cleaning up your Mac menu bar layout and have a cleaner visual landscape: http://www.macbartender.com/

Aloha! [1]



[1] "Since the middle of the 19th century, it also has come to be used as anEnglish greeting to say goodbye and hello."
Source: http://en.wikipedia.org/wiki/Aloha

24 de mayo de 2011

Link a video de Youtube que empiece a reproducir en un instante dado

Tip interesante:

¿Cómo pasarle un link a alguien de un video de Youtube, pero que cuando lo vea empiece a reproducirse desde cierto minuto y segundo?

Así:

Link base:
http://www.youtube.com/watch?v=-FucbvoFFy0
Momento en que quiero que se empiece a reproducir cuando abra el link:
cero minutos, once segundos
Link con un tiempo en particular para el inicio de reproducción:
http://www.youtube.com/watch?v=-FucbvoFFy0&t=0m11s
Notar el "t=0m11s" al final del link. "t=0m" indica la cantidad de minutos y "11s" los segundos a desplazar, desde el inicio del video, al empezar a reproducir.


Post dedicado al copado de Ale Peralta, que me hizo conocer este truquito.

[Update: ¡Gracias Humitos ( humitos.wordpress.com ) por el comentario! ]