Skip to content

Instantly share code, notes, and snippets.

Working from home

Thiago Ribeiro thiagovsk

Working from home
View GitHub Profile
View generate-cert.rb
require 'openssl'
require 'fileutils'
require 'acme-client'
require 'byebug'
ENV['SSL_ADDR'] = ''
ENV['APPLICATION_ENV'] = 'development'
puts 'Registering client'
View .vimrc
" Load Pathogen
execute pathogen#infect()
" Use Vim settings, rather then Vi settings (much better!).
set nocompatible
" Default configuration in case there's no other definition in ftplugin
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
thiagovsk / show.rb
Created Feb 6, 2017
ajudando o luiz a fazer group_by
View show.rb
a = [ {x: 'Abril/17', y: 10}, {x: 'Abril/17', y: 5}, {x: 'Abril/17', y: 2}, {x: 'Dezembro/17', y: 12}, ]
luiz = a.group_by{ |hash| hash[:x] }.map do |k,v|
{:x => k, :y =>{ |hash| hash[:y] }.inject(:+)}
View techtalk.txt
- Primeira coisa a se fazer no git: Configurar o global user e global email
- Dia dia git, o que fazer quando ligo meu pc para trabalhar?
- Diferença entre merge e rebase? Pra que servem?
- Infinitos comandos git, logo um gitconfig pra facilitar as coisas.
- Comandos úteis (avançados...?)
- git branch -a
- git cherry-pick -x
- git commit -p
View parse_wads.rb
def parse_wads(wads, content = {})
unless wads.empty?
wads.each_with_index do |item, index|
if item['text']
scan = item['text'].gsub('\\n', '\n').match(/(?:\s|^)(\S+)@$/m)
if scan && wads[index + 1]
text = wads[index + 1]['text']
content[:email] = scan.to_s.strip.downcase
content[:email] << text if text
View teste.rb
class Foo
puts "nao precisa de self"
def self.ble
View application_record.rb
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
View _customer-form.html
<form name="form" ng-submit="vm.submitForm(vm.customer)" class="form-horizontal" novalidate>
<div class="panel panel-default">
<div class="panel-header">
<h2 class="panel-heading">
<span ng-if="!">Adição de Cliente</span>
<span ng-if="">Edição de Cliente</span>
<div class="panel-body">
View gitconfig
# set your user tokens as environment variables, such as ~/.secrets
# See the README for examples.
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
View http.ruby
require 'net/http'
require 'time'
@response = Net::HTTP.get_response(URI(''))
puts "Response:"
puts @response.header.to_hash
def response
@response = Net::HTTP.get_response(URI(''))