Skip to content

Instantly share code, notes, and snippets.

View thiagovsk's full-sized avatar
🏠
Working from home

Thiago Ribeiro thiagovsk

🏠
Working from home
View GitHub Profile
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'
" 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 February 6, 2017 14:16
ajudando o luiz a fazer group_by
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
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
class Foo
def self.bar
puts "nao precisa de self"
end
def self.ble
bar
end
end
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
<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>
@thiagovsk
thiagovsk / 1618.cpp
Created October 1, 2014 14:25
1618 uri
#include<iostream>
using namespace std;
int main(){
int entrada;
bool check = false;
cin >> entrada;
@thiagovsk
thiagovsk / gitconfig
Created September 21, 2016 13:32
git alias
# 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
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