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
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 / 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
@thiagovsk
thiagovsk / simple-twitter.rb
Created August 9, 2016 17:31 — forked from coderberry/simple-twitter.rb
Application oauth2 for Twitter using Ruby
require 'oauth'
require 'httpclient'
require 'json'
class SimpleTwitter
def initialize(config)
@config = config
@http_client = HTTPClient.new
end
@thiagovsk
thiagovsk / helper.rb
Created May 16, 2016 13:36
criando modulo sendo incluido na classe como metodo de instancia e de classe
module Foo
def self.included base
base.send :include, InstanceMethods
base.extend ClassMethods
end
module InstanceMethods
def bar1
'bar1'
end
@thiagovsk
thiagovsk / helper.rb
Created May 16, 2016 13:34
criando modulo sendo incluido na classe como metodo de instancia
module Foo
def self.included base
base.extend ClassMethods
end
module ClassMethods
def bar2
puts 'bar2'
end
end
############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
#
# COPY AND PASTE