Skip to content

Instantly share code, notes, and snippets.

@franzejr
franzejr / simpleFormPanelExtJS4.js
Created June 10, 2012 22:48
Steps to create a simple form and window in ExtJS4
//OnReady Ext function
Ext.onReady(function(){
//Creating a namespace
Ext.ns("Test");
Ext.define("Test.InformationsFormPanel",
{
@franzejr
franzejr / simpleTextFieldExtJS4.js
Created June 10, 2012 22:59
Simple TextField ext Form
//Ext on Ready function
Ext.onReady(function(){
//Creating a simple form
var formPanel = Ext.create('Ext.form.Panel', {
title: 'Panel Title',
widh:100,
height:200,
frame:true,
defaultType: 'textfield',
items: [
@franzejr
franzejr / htmlExtJS4.html
Created June 11, 2012 00:06
HTML for ExtJS
<!DOCTYPE html>
<html>
<head>
<title>Hello ExtJS4</title>
<!--styles-->
<link rel="stylesheet" type="text/css" href="http://cdn.sencha.io/extjs/4.1.0.b1/resources/css/ext-all.css">
<!--extjs 4.0.2-->
<script type="text/javascript" charset="utf-8" src="http://cdn.sencha.io/ext-4.1.0-gpl/ext-all.js"></script>
<!--app-->
<script type="text/javascript">
@franzejr
franzejr / routing_test.rb
Created June 21, 2012 02:00
Routing Test with Rspec
# encoding: UTF-8
require 'spec_helper'
describe OccurrencesController do
context "Show Occurrence" do
it "show one occurence" do
{ :get => "/events/1/tracks/2/occurrences/3/" }.
should route_to(
:controller => "occurrences",
:action => "show",
@franzejr
franzejr / sending_emails.rb
Created August 3, 2012 00:24
Sending emails with sendmail - ssmtp - Linux
#Using ssmtp to send emails in Rails 3
#http://franzejr.wordpress.com/2012/08/02/sending-emails-from-a-ubuntu-server-gmail/
#http://franzejr.wordpress.com/2012/08/03/sending-e-mails-with-sendmail-in-rails-3/
#In your environment.rb
ActionMailer::Base.delivery_method = :sendmail
ActionMailer::Base.sendmail_settings = {
:location => "ssmtp",
:arguments => "-i"
}
@franzejr
franzejr / get_strings.cpp
Created November 16, 2012 00:48
Get strings from a file and save into a vector<string>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main(){
char temp[200];
vector<string> strings;
@franzejr
franzejr / line_by_line.php
Created January 10, 2013 22:38
Lendo linha por linha de um arquivo...
$usuario_senha = file_get_contents("users.txt");
$usuarios = array();
//Lendo linha por linha para pegar os usuarios
foreach(preg_split("/((\r?\n)|(\r\n?))/", $usuario_senha) as $line){
//echo $line."<br/>";
$line_it = explode(":", $line);
$usuarios[$line_it[0]] = $line_it[1];
}
@franzejr
franzejr / download_cookie.sh
Created January 18, 2013 02:41
Login and download files(for example from a site with authentication)
@franzejr
franzejr / gist:8954754
Last active August 29, 2015 13:56
User error
[21] sharewizz(main)> User.create(id:3989,first_name: "Francisco", last_name:"Lins",terms:true,name:"FranzeJr2", email:"email@gmail.com",password:"password")
(0.2ms) BEGIN
User Load (14.2ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'email@gmail.com' LIMIT 1
User Load (10.5ms) SELECT `users`.* FROM `users` WHERE `users`.`confirmation_token` = '2df949add7a9e970ff949066f5a6b7105fa42a1c19ea7d245cb54b71f5f1eef5' LIMIT 1
SQL (0.9ms) INSERT INTO `users` (`activated`, `authentication_token`, `bio`, `chat_enabled`, `checked_messages_at`, `checked_notifications_at`, `checked_wizzes_at`, `confirmation_sent_at`, `confirmation_token`, `confirmed_at`, `connected`, `created_at`, `current_sign_in_at`, `current_sign_in_ip`, `deleted_at`, `delta`, `email`, `encrypted_password`, `first_name`, `is_admin`, `is_company`, `language`, `last_name`, `last_sign_in_at`, `last_sign_in_ip`, `name`, `nb_objects`, `password_salt`, `picture`, `rating_average`, `remember_created_at`, `reset_password_sent_at`, `reset_
@franzejr
franzejr / gist:9261112
Created February 27, 2014 22:36
Git branch in prompt
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "