Skip to content

Instantly share code, notes, and snippets.

View jaksonmoura's full-sized avatar
🎯
Focusing

Jakson Moura jaksonmoura

🎯
Focusing
  • Brazil
View GitHub Profile
@jaksonmoura
jaksonmoura / siafem.rb
Created July 27, 2015 16:33
A code I made for copying a part of the content in every line
notes = []
File.open("test.txt").each do |line|
# record in a array var all the lines until find [fim]
notes.push(line)
if (line.include? "TOTAL DO EMPENHO:")
# get total empenho value
total_empenho = notes[-1]
total_empenho = total_empenho.slice(18,11)
# puts total_empenho
@jaksonmoura
jaksonmoura / .gitignore_global.md
Last active August 29, 2015 14:18
Adicionar uma lista para ignorar de forma global ao Git

Crie o arquivo ~/.gitignore_global

e rode:

git config --global core.excludesfile ~/.gitignore_global

depois cole isto:

.DS_Store
.AppleDouble
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
@jaksonmoura
jaksonmoura / .zshrc
Last active December 29, 2019 13:21
My zshrc config file
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases
class FizzBuzz
def fizzbuzz(i)
return "FizzBuzz" if i % 3 == 0 and i % 5 == 0 or (i.to_s =~ /5/ and i.to_s =~ /3/ )
return "Buzz" if i % 5 == 0 or i.to_s =~ /5/
return "Fizz" if i % 3 == 0 or i.to_s =~ /3/
i # Retorna "i" se nenhuma das ações anteriores acontecerem
end
end
@fizzbuzz = FizzBuzz.new
class Bissexto
def bissexto(ano)
if inteiro(ano)
if ano % 4 == 0 && ano % 100 != 0 || ano % 400 == 0
return true
end
return false
else
return nil
# http://codekata.pragprog.com/2007/01/kata_two_karate.html
class Chop
def chop(int, ar)
return -1 unless ar.include?(int)
return ar.index(int)
end
end
require 'test/unit'
require "./Troco.rb"
class TestTroco < Test::Unit::TestCase
def setup
@t = Troco.new
end
def teardown
@t = nil
@jaksonmoura
jaksonmoura / http_getter.rb
Created August 7, 2011 23:30
Capturando informações de um site
# encoding: UTF-8
require 'net/http'
require 'open-uri'
class Http
# Responsável pela execução da aplicação
def run
puts "==== Bem-vindo! ====\n" + "Por favor, digite um site:"
www = gets.chomp
get_data(www)