Skip to content

Instantly share code, notes, and snippets.

View paulodiniz's full-sized avatar
🐕

Paulo Diniz paulodiniz

🐕
View GitHub Profile
module Mst
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def before(method_name)
m = instance_method(method_name)
define_method method_name do |*args, &block|
class Carro
def Carro.valor_do_financiamento(carro_id)
carro = Carro.find(carro_id)
#calcula valor
return valor_total
end
end
carro = Carro.find(params[:carro_id]) # carrega o carro que o usuario passou no POST
valor_do_financiamento = Carro.valor_do_financiamento(carro.id)
import collections
print 'Regular dictionary:'
d = {}
d['a'] = 'A'
d['b'] = 'B'
d['c'] = 'C'
d['d'] = 'D'
d['e'] = 'E'
15:56:52.294 [error] GenServer #PID<0.1242.0> terminating
** (FunctionClauseError) no function clause matching in :http_transport.close/2
(inets) http_transport.erl:346: :http_transport.close(:undefined, #Port<0.10039>)
(stdlib) gen_server.erl:643: :gen_server.try_terminate/3
(stdlib) gen_server.erl:809: :gen_server.terminate/7
(stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {:init_error, :error_sending, {#Reference<0.0.4.973>, {:error, :closed}}}
func qsort(a []int) []int {
if len(a) < 2 { return a }
left, right := 0, len(a) - 1
// Pick a pivot
pivotIndex := rand.Int() % len(a)
// Move the pivot to the right
a[pivotIndex], a[right] = a[right], a[pivotIndex]
```lisp
(spacemacs|create-align-repeat-x "brackets" "\\(\\s-*\\){" nil t)
(spacemacs/set-leader-keys "xa{" 'spacemacs/align-repeat-brackets)
```
(spacemacs|create-align-repeat-x "brackets" "\\(\\s-*\\){" nil t)
(spacemacs/set-leader-keys "xa{" 'spacemacs/align-repeat-brackets)
class AddTypeToBoleto < ActiveRecord::Migration[5.1]
class Boleto < ApplicationRecord; end
def change
add_column :boletos, :type, :string
Boleto.find_each do |boleto|
boleto.type = 'boleto_bancario'
boleto.save!
end

Keybase proof

I hereby claim:

  • I am paulodiniz on github.
  • I am paulodiniz (https://keybase.io/paulodiniz) on keybase.
  • I have a public key ASAPM9sW68LsaKfaPl04V9jKsmhp4lOdDhQHkATmQQojYQo

To claim this, I am signing this object:

package main
import(
"fmt"
"flag"
"os"
"log"
"path/filepath"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/kubernetes"