Skip to content

Instantly share code, notes, and snippets.

Jonathan Welzel jnwelzel

Block or report user

Report or block jnwelzel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jnwelzel
jnwelzel / estados.json
Created Aug 1, 2012
JSON que eu usei para gerar os documents da collection de estados no mongodb
View estados.json
[{"_id":11,"nome":"Rond\u00f4nia","pais_id":1058,"sigla":"RO"},{"_id":12,"nome":"Acre","pais_id":1058,"sigla":"AC"},{"_id":13,"nome":"Amazonas","pais_id":1058,"sigla":"AM"},{"_id":14,"nome":"Roraima","pais_id":1058,"sigla":"RR"},{"_id":15,"nome":"Par\u00e1","pais_id":1058,"sigla":"PA"},{"_id":16,"nome":"Amap\u00e1","pais_id":1058,"sigla":"AP"},{"_id":17,"nome":"Tocantins","pais_id":1058,"sigla":"TO"},{"_id":21,"nome":"Maranh\u00e3o","pais_id":1058,"sigla":"MA"},{"_id":22,"nome":"Piau\u00ed","pais_id":1058,"sigla":"PI"},{"_id":23,"nome":"Cear\u00e1","pais_id":1058,"sigla":"CE"},{"_id":24,"nome":"Rio Grande do Norte","pais_id":1058,"sigla":"RN"},{"_id":25,"nome":"Para\u00edba","pais_id":1058,"sigla":"PB"},{"_id":26,"nome":"Pernambuco","pais_id":1058,"sigla":"PE"},{"_id":27,"nome":"Alagoas","pais_id":1058,"sigla":"AL"},{"_id":28,"nome":"Sergipe","pais_id":1058,"sigla":"SE"},{"_id":29,"nome":"Bahia","pais_id":1058,"sigla":"BA"},{"_id":31,"nome":"Minas Gerais","pais_id":1058,"sigla":"MG"},{"_id":32,"nome":"Esp\u00
@jnwelzel
jnwelzel / cidades.json
Created Aug 1, 2012
JSON que eu usei para gerar os documents da collection de cidades no mongodb
View cidades.json
[{"estado_id":11,"_id":1100015,"nome":"Alta Floresta D'Oeste"},{"estado_id":11,"_id":1100023,"nome":"Ariquemes"},{"estado_id":11,"_id":1100031,"nome":"Cabixi"},{"estado_id":11,"_id":1100049,"nome":"Cacoal"},{"estado_id":11,"_id":1100056,"nome":"Cerejeiras"},{"estado_id":11,"_id":1100064,"nome":"Colorado do Oeste"},{"estado_id":11,"_id":1100072,"nome":"Corumbiara"},{"estado_id":11,"_id":1100080,"nome":"Costa Marques"},{"estado_id":11,"_id":1100098,"nome":"Espig\u00e3o D'Oeste"},{"estado_id":11,"_id":1100106,"nome":"Guajar\u00e1-Mirim"},{"estado_id":11,"_id":1100114,"nome":"Jaru"},{"estado_id":11,"_id":1100122,"nome":"Ji-Paran\u00e1"},{"estado_id":11,"_id":1100130,"nome":"Machadinho D'Oeste"},{"estado_id":11,"_id":1100148,"nome":"Nova Brasil\u00e2ndia D'Oeste"},{"estado_id":11,"_id":1100155,"nome":"Ouro Preto do Oeste"},{"estado_id":11,"_id":1100189,"nome":"Pimenta Bueno"},{"estado_id":11,"_id":1100205,"nome":"Porto Velho"},{"estado_id":11,"_id":1100254,"nome":"Presidente M\u00e9dici"},{"estado_id":11,"_id":110
@jnwelzel
jnwelzel / company_user_rel.rb
Created Aug 13, 2012
Company -> User (owner)
View company_user_rel.rb
class Company
include Mongoid::Document
include Mongoid::Timestamps
has_and_belongs_to_many :users
belongs_to :owner, class_name: "User", inverse_of: :owns
end
class User
include Mongoid::Document
View application.css.scss
@import "jbar.colors";
@import "jbar";
@jnwelzel
jnwelzel / HttpProxyAuth.java
Created Apr 4, 2013
The boilerplate needed to make a http request behind a proxy that requires authentication
View HttpProxyAuth.java
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 5000);
HttpConnectionParams.setSoTimeout(httpParams, 5000);
DefaultHttpClient client = new DefaultHttpClient(httpParams);
client.getCredentialsProvider().setCredentials(
new AuthScope(PROXY_HOSTNAME, PROXY_PORT),
new UsernamePasswordCredentials(PROXY_USERNAME, PROXY_USERPWD));
HttpHost proxy = new HttpHost(PROXY_HOSTNAME, PROXY_PORT);
client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
View messages_controller.rb
# 1. not working
redirect_to contact_path(@message), :flash => { :error => "Captcha error! The image code you informed is incorrect."}
# 2. not working
flash[:error] = "Captcha error! The image code you informed is incorrect."
redirect_to contact_path(@message)
# 3. WORKING
flash[:error] = "Captcha error! The image code you informed is incorrect."
render "new"
@jnwelzel
jnwelzel / search_form.scala.html
Created Jul 20, 2013
twitter bootstrap search form the way i like it
View search_form.scala.html
<div id="actions">
<form action="@link(0, "name")" method="GET" class="form-search">
<div class="input-append">
<input type="search" id="searchbox" name="f" value="@currentFilter" placeholder="Filter by device name..." class="input-medium search-query">
<button type="submit" id="device-search-submit" class="btn"><i class="icon-search"></i> Search</button>
</div>
</form>
</div>
@jnwelzel
jnwelzel / sql_notes.sql
Last active Jan 2, 2016
Since I suck at SQL, here are a few notes and reminders if ever my memory fails me (and it always does)
View sql_notes.sql
UPDATE table_name
SET column1=value1
WHERE some_column=some_value;
ALTER TABLE table_name
ADD column_name datatype;
/* SQL Server */
alter table DEFAULT_PROPRIED_DOCTO
add VERSION bigint not null default 1;
@jnwelzel
jnwelzel / vlc_red_hat.md
Last active Jan 2, 2016
How to install VLC Media Player on Red Hat
View vlc_red_hat.md

Installing VLC Media Player on Red Hat

My Red Hat version: 6.5 (Santiago)
My architecture: x86_64

  1. Head over to http://rpmfusion.org/Configuration, download the RPM and install it. This will end up enabling the RPM Fusion repo on your machine. Later you can disable it if you prefer by editing the corresponding *.repo file inside the /etc/yum.repos.d/ directory. This might avoid unecessary conflicts later on.
  2. Now to install VLC open up your terminal and use $ sudo yum install vlc.x86_64 (you might have to update yum repos first, not sure).

That's it!

@jnwelzel
jnwelzel / perguntas_empresa.md
Last active Jan 2, 2016
Perguntas a serem feitas pelo funcionário na hora da contratação que lá na frente podem evitar dores de cabeça.
View perguntas_empresa.md
  1. Vou ter que abrir outra conta bancária só pra receber o salário de vocês?
  2. Empresa dispõe de estacionamento coberto? Pra mim, que tenho moto, isso é essencial.
  3. Se não quiserem te dar tempo pra pensar na proposta e ficarem tentando te forçar a dar logo uma resposta se vai aceitar o cargo ou não, tome cuidado porque essa empresa provavelmente é ejaculação precoce e vai botar pressão p caramba. Esteja ciente disso.
You can’t perform that action at this time.