Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
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'] = '2804.7f3.8481.3cf7.x.4.ip6.name'
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
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 => v.map{ |hash| hash[:y] }.inject(:+)}
end
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?
- https://blog.kitware.com/source/files/3_593278662_png
- https://www.atlassian.com/git/tutorials/merging-vs-rebasing/conceptual-overview
- 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
end
View teste.rb
class Foo
def self.bar
puts "nao precisa de self"
end
def self.ble
bar
end
end
View application_record.rb
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
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="!vm.customer.id">Adição de Cliente</span>
<span ng-if="vm.customer.id">Edição de Cliente</span>
</h2>
</div>
<div class="panel-body">
<fieldset>
View gitconfig
# set your user tokens as environment variables, such as ~/.secrets
# See the README for examples.
[color]
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('https://about.gitlab.com'))
puts "Response:"
puts @response.header.to_hash
def response
@response = Net::HTTP.get_response(URI('https://about.gitlab.com'))
end