Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

GilcierWeb gilcierweb

🏠
Working from home
View GitHub Profile
@gilcierweb
gilcierweb / _form.html.erb
Last active Jan 17, 2019
Upload image crop with Ruby and Rails, CarrierWave and Cropper.js
View _form.html.erb
#app/views/businesses/_form.html.erb
<%= form_with(model: business, scope: :business, local: true, :html => {multipart: true}) do |form| %>
<div class="row">
<div class="col-md-12">
<%= form.file_field :logo_image, id: :business_logo_image %>
<%= form.label :logo_image, class: 'upload' do %>
<i class="material-icons">file_upload</i>
<span>Choose image</span>
@gilcierweb
gilcierweb / deploy.rb
Created Oct 12, 2017
Mina deploy ruby on rails 5.1 ++
View deploy.rb
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (https://rbenv.org)
# require 'mina/rvm' # for rvm support. (https://rvm.io)
set :application_name, 'my_app'
set :domain, 'my_server'
set :deploy_to, '/home/rails/my_app'
set :repository, 'git@bitbucket.org:my_user/my_app.git'
set :branch, 'master'
@gilcierweb
gilcierweb / index.html
Last active Apr 8, 2020
Component Vue.js search CEP or Zip code
View index.html
<!doctype html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="author"
content="GilcierWeb - Web Developer - gilcierweb@gmail.com - gilcier06@yahoo.com.br - Sites, Sistemas para Web, E-commerce, Manutenção de Sites."/>
<meta name="doc-rights" content="Private"/>
@gilcierweb
gilcierweb / pt-BR.yml
Created Mar 12, 2017
Translate pt-BR Ruby on Rails
View pt-BR.yml
pt-BR:
activerecord:
errors:
template:
header:
one: "1 erro proibiu este %{model} de ser salvo:"
other: "%{count} erros proibiram este %{model} de ser salvo:"
body: 'Ocorreram problemas com os seguintes campos:'
messages:
record_invalid: 'A validação falhou: %{errors}'
View send_push_notification_android.php
<?php
//FCM setup for Android Push Notifications
//https://medium.com/@ankushaggarwal/gcm-setup-for-android-push-notifications-656cfdd8adbd#.qootgsyzm
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
(
'message' => 'GilcierWeb App ionic, Ruby and Rails, Elixir',
View palindrome.rb
#!/usr/bin/ruby
# test gilcier
# In terminal execute ruby palindrome.rb
class String
def initialize(word)
@word = word.to_s.strip.downcase
end
@gilcierweb
gilcierweb / number.rb
Last active Aug 29, 2015
Function format number Ruby
View number.rb
#number.rb
puts 'Informe um número'
number = gets.chomp
def format_number(number)
for num in 0..number.to_i
puts num.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
end
@gilcierweb
gilcierweb / cidadesBrasilerias.yml
Last active Jun 24, 2017
Cidades do Brasil IBGE 2014
View cidadesBrasilerias.yml
31|1|12|1200013|Acrelândia
31|1|12|1200054|Assis Brasil
31|1|12|1200104|Brasiléia
31|1|12|1200138|Bujari
31|1|12|1200179|Capixaba
31|1|12|1200203|Cruzeiro do Sul
31|1|12|1200252|Epitaciolândia
31|1|12|1200302|Feijó
31|1|12|1200328|Jordão
31|1|12|1200336|Mâncio Lima
You can’t perform that action at this time.