We usually create HTML files in our Github repositories, but how to show this data in the browser? RawGit is a solution to serve files with the correct content types.
Example: The WordPress
readme.html file can be shown in the following URL:
You only need to follow the formula:
The advantage of using RawGit over Github Pages is that RawGit works with all branches, while Github Pages requires a gh-pages branch. Last not the least, the source code of this solution is also available in Github.
I am attending to a post-degree program and one of its courses is Server-Side Scripting. The professor gave us a project which students should create a project and my colleague and I created a Sinatra REST API for a todo list application.
Last week I presented in Code & Coffee about WordPress and Gulp. In my 10 minutes talk, I explained briefly what is Gulp and how its tasks can save our time.
Here are my slides and the example repository that I created for the event.
bower_components are a pain in the neck because every time that we need to find something in the project the content of these folders will be used in the search.
Sublime offers 2 settings to hide these files from the index. First of all, open the User Preferences (Preferences -> Settings – User):
binary_file_patterns: This option excludes files from the index but keep them in the sidebar.
folder_exclude_patterns: This option excludes files from the index and sidebar. This is why, for example, you don’t see the
.git folder in a project.
I’ve in my development mac different virtualhosts, using .local or .wp TLDs. Opening these address in Chrome are slow – about 3 seconds ‘resolving address’. This situation doesn’t happen in Safari or Firefox. Here is my typical
This is an old trick that saved me several times. Sometimes people forget to setup their name and email information. The following script is useful to fix mistakes:
This post is also available in English.
Um dos meus programas de rádio favoritos é o Central 98, da 98FM (de Belo Horizonte). Ele começa às 10h da manhã e devido a diferença de 6h de fuso horário eu não consigo ouví-lo ao vivo. Então, criei um shell script para gravar o programa e assim posso ouvi-lo no meu tempo livre.
Esse artigo está disponível em português.
One of my favourite radio shows happens every day at 10 AM (Brasilia Timezone). I was unable to listen to it because the time zones. Then, I created the following small shell script to record the show and then I can listen to it in my free time.
the ink magazine was an assignment of my HTML & CSS classes in the Web and Mobile App Design and Development program, performed in Langara College.
The students was supposed to create a magazine responsive layout using HTML/CSS. (I usually use Gulp and SASS in my projects, however, I didn’t use extra tools in this task).
The source code is available in my Github profile.
Almost 3 years ago I wrote (in Portuguese) a post about my Sublime Text settings. Now, I updated my tips in an English post.
1. Free video course
If you know nothing about Sublime, please watch these free videos from tut+.
2. Package Control
First of all, you should install Package Control to manage plugins. Actually, you can install packages just copying the package files to correct folder, however, Package Control is easier than copy & paste. Open Sublime Text console (View > Show Console or
ctrl + `) and paste the following line:
I decided write a post describing some tools that I use in my MacBook to enhance my tasks.
How awesome is Alfred? It is totally awesome! Alfred is a great tool working as a shortcut to daily tasks. More than that, you can create customized workflows that improve even more your productivity. You must see:
- Yet another layouter: you can use keyworks like top left, top right to resize and move windows. This is really useful for people who use multiple displays
- Battery: it is a workflow that shows relevant information about battery, such as charge cycles, health and serial number
- Alfred Workflows Forum: the community forum where people share their workflows
- Packal: an unofficial directory of workflows and themes. My currently theme is the Elegant v4, but you can choose your favorite in several options.
I have just moved this week to Vancouver. I started my Web and Mobile App Design and Development post-degree in Langara.
Maybe I should write a blog talking about cultural differences between Brazil and Canada, like dozens of Brazilians but I think that those pages show limited or inaccurate point of views.
New times are coming! :)
Data is usually explained in tables or charts, but people sometimes commit mistakes when they add in them redundant or boring elements. A good table or chart is worth a thousand words and the following three gifs show how to improve your presentations. Source
Some years ago, precisely on July/2008 I created codestacker. I know, there were several options to collect snippets, but I decided to code my own solution. More than that I have planned to develop a Textmate bundle and a Mac OS Widget (who cares?), however I did not code these functions.
In the latest days, I migrated all old data to a new app written in Rails 4.2 and hosted on Heroku. The source code is available in Github.
Sometimes it is necessary to serve a folder with static resources (images, for example) as a web server. The probably most popular commands to perform these tasks are:
php -S localhost:9999
python -m SimpleHTTPServer 9999
The option that uses PHP built-in web server requires PHP 5.4+. The following gist provides several other ways to run a webserver locally.
First of all, you must see Dev Tips: developer tips delivered daily in your email.
Now, these are some useful extensions that I’ve been using in Chrome to help me to develop webapps:
Sometimes people cann’t believe in their infrastructure. This can be easily understood because maintaining complex software integrates several pieces of information. Moreover, people sometimes hire bad IT solutions and as a result,
shit accidents happen.
I have been using some tools to report me web server down time. Here we go:
- monitor.us: it is a powerful tool that provides several features. I am currently using it to monitor a specific term in a specific page. It’s a free feature and it can check a website from 2 different countries
- Pingdom: it looks like a full solution to analyse performance issues and downtime
- Pingoou: this a Brazilian option. It offers up to 3 URLs in the free account and notifications via SMS, Campfire, Hipchat and email in the paid accounts
- SiteUptime: 1 monitor for free each 30 minutes. Actually is not the best deal
- UptimeRobot: it monitors up to 50 websites for free
Building it own tool
You can alternatively build your own monitoring tool to check if a website is up or down. The concept is pretty simple: you can use your favorite language to create a script that loads a page and then you are able to check a specific string in the document. In the following example I used Ruby and Mechanize gem to request a status page.
In this case, I use Heroku to run this script. The emails are delivered by SendGrid, via Pony gem. There are no costs in the process.
This post is also published in coderwall.
I took the TOEFL exam some weeks ago. This is one of most popular tests to prove English skills. It is considered by many people a tough exam because it requires not only English skills, but also time management skills.
The test takes 4 hours to be finished. The last part of the test is to write 2 texts in 50 minutes. In the first task, the student is supposed to summarise a text and a lecture, which lecture sometimes cast doubt in the passage. The second one is called independent task. In this task the student should write about a specific subject. During my preparation, I written more than 50 texts and I believe that practice makes perfection. After this hard work, I imagined create a simple app with exercises and tips to improve the writing skills.
Writing for IELTS and TOEFL has 100 exercises to practice writing. In addition, I collected several tips to improve writing skills, such as an effective checklist and an extensive explanation about linking words. All these tips are useful in my exam.
The app is available on Google Play and Apple Store and it costs US$0.99.
I stopped writing in this blog for a while. I have been using this blog since 2005 and my absence is justified by live changes.
I am going to write my posts in English but texts in Portuguese could appear eventually. Sorry for eventual grammar mistakes ;)
Sempre que você está executando um script automatizado que usa o MySQL você possivelmente se pergunta como aplicará alguma boa prática para evitar a inserção de senha diretamente no shell.
Fiz uma pesquisa rápida sobre o assunto e encontrei duas soluções:
Você pode usar a variável
MYSQL_PWD para armazenar uma senha de conexão com o banco. Exemplo:
mysql -h127.0.0.1 -uuser -e "show processlist"
No caso acima o
mysql está sendo usado sem a opção
-p, que é opção utilizada para informar a senha do banco. O comando só é executado com sucesso pois o MySQL automaticamente identifica a variável
MYSQL_PWD. Utilizei a opção
-e para executar via shell o comando
show processlist, que lista as queries em processamento no momento.
2) Arquivo adicional de configuração
Outra opção interessante é criar um arquivo
.my.cnf com os parâmetros de conexão com o banco e guardá-lo em sua pasta de usuário. Exemplo:
Lembre-se de dar permissão de acesso a esse arquivo somente para o seu usuário:
chmod 600 .my.cnf
Feito isso, quando necessário executar o
mysql, basta informar as credenciais de conexão do seu arquivo:
mysql --defaults-extra-file=.my.cnf -e "show processlist"
Atenção: Lembre-se sempre de rever as permissões do usuário do MySQL que executará scripts. Evite sempre dar privilégios a mais e assim você poderá evitar grandes tragédias :)