Category Archives: Programação

Custom Protractor Flake shard parser

PR #45 on Protractor Flake added the ability to specify custom parsers. On my project we’re sharding (running multiple instances of) Protractor and using the following parser to re-run only the failing spec files. You’ll want to replace the /test/functional/specs/ and the browser name (chrome) below with your actual values. 1 2 3 4 5 […]

Download file using WinJS.xhr

Snippet to download a file using WinJS.xhr and save it. The file variable below is a StorageFile, result of pickSaveFileAsync. Note the usage of responseType: “blob” as an option to xhr, and how it is copied to the file stream with msDetachStream. 1 2 3 4 5 6 7 8 9 10 11 12 13 […]

PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))

Atualizei o XCode da versão 4.6.0 para 4.6.01 e de repente meus projetos não construíam mais, dando o erro: PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27)) A solução foi simplesmente limpar o projeto. Vá ao menu “Product” e selecione “Clean”.

Powershell script to snap an app in Windows 8

You can not, from inside a Windows 8 application, snap it. That doesn’t mean there is no other way At work, we have to test our app in a snapped state, so we need a way to programmatically make it happen. We discovered that there are two keyboard shortcuts for this action. Windows Key + […]

Get current session id on Ruby Selenium WebDriver

1 @browser.instance_variable_get(’@bridge’).instance_variable_get(’@session_id’)@browser.instance_variable_get(‘@bridge’).instance_variable_get(‘@session_id’)

Javascript function to find background task by name on Windows 8

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 FindTask: function (taskName) { var background = Windows.ApplicationModel.Background; var iter = background.BackgroundTaskRegistration.allTasks.first(); var hascur = iter.hasCurrent;   while (hascur) { var cur = iter.current.value;   if (cur.name === taskName) { return cur; }   hascur = iter.moveNext(); } […]

MD5 in YQL in hexadecimal form using Javascript

Undocumented YQL crypto method to return a hexadecimal representation of the MD5 encoding of a string: 1 y.crypto.encodeMd5Hex(’some string’);y.crypto.encodeMd5Hex(‘some string’);

Leiningen, ClojureScript e REPL no navegador

REPL do Clojure no navegador http://nakkaya.com/2011/12/04/leiningen-clojurescript-and-browser-repl/

Plugin do Eclipse para editar scripts bash

Meu projeto atual tem arquivos .php, .pm e .sh no mesmo diretório. Aos poucos fui achando os plugins para o Eclipse, e às vezes até múltiplos para a mesma linguagem de programação. E para bash, eu achei o ShellEd. Por enquanto está muito bom. Mesmo o projeto tendo sido criado para PHP, os arquivos .sh […]

Clojure script to parse IIS logs from a directory and show slowest pages

Just having some fun today. The code runs actually pretty fast: It reads over 1.5 million lines from 1.1GB of logs and sorts them by time-taken in 5 seconds. I bet there’s room for improvement but it was enough for my needs. 1 2 3 4 5 6 7 8 9 10 11 12 13 […]