Skip to content

Instantly share code, notes, and snippets.

View ronanrodrigo's full-sized avatar
🚀
Go!

Ronan Rodrigo Nunes ronanrodrigo

🚀
Go!
View GitHub Profile
@ronanrodrigo
ronanrodrigo / Gemfile
Created June 10, 2013 04:10
Eventos recorrentes no ruby on rails. A criação recorrência de eventos em qualquer ambiente, requer uma avançada lógica de regras. Entre as dificuldades está os Time Zones, UTC e o querido mês de Fevereiro. Pra facilitar tudo isso, existe uma gem chamada Ice Cube. Que irá ajudar a criar uma regra de repetição para um evento. Fonte: http://seejoh…
gem 'ice_cube'
@ronanrodrigo
ronanrodrigo / diet.rb
Last active December 18, 2015 11:49
Using polymorphic. With this, is possible to make a relation with any object.
# models/diet.rb
class Diet < ActiveRecord::Base
include Todoable
end
@ronanrodrigo
ronanrodrigo / locale_spec.rb
Last active December 22, 2015 18:39
Validate locale files with rspec!
require 'spec_helper'
describe "Validade lines of locales files", js: true do
after(:each) do
counter = 1
base_file = File.new(@locale_files.first)
while (line = base_file.gets)
counter = counter + 1
end
@ronanrodrigo
ronanrodrigo / TopPanel
Created September 13, 2013 19:07
Jenkins TopPanel
#top-panel{background:#2b3238;background-size:100% 100%;}#top-panel td#login-field span a{background:none;}#top-panel td #searchform a{background:none;height:auto;width:auto;}#top-panel td>a{background:url("http://nullblock.com/img/nbhead.png") 0 0 no-repeat;display:block;width:124px;height:40px;margin:10px 0 10px 10px;}#top-panel td>a img{display:none;}#main-table{background-color:#fff!important;background-image:none!important;}
Locales =
en:
dates:
format: 'mm/dd/yyyy'
weekStart: 0
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'simple_form', '3.0.0'
gem 'nested_form', '0.3.2'
gem 'sidekiq', '2.14.1'
gem 'sidekiq_mailer', '0.0.6'
gem 'will_paginate', '3.0.4', github: 'mislav/will_paginate', branch: 'master'
gem 'mongoid_taggable', '1.1.1'
gem 'activesupport', '4.0.0'
//= require jquery
//= require jquery_ujs
//= require modernizr
//= require twitter/bootstrap/transition
//= require twitter/bootstrap/alert
//= require twitter/bootstrap/modal
//= require twitter/bootstrap/dropdown
//= require twitter/bootstrap/scrollspy
//= require twitter/bootstrap/tab
//= require twitter/bootstrap/tooltip
@ronanrodrigo
ronanrodrigo / cunsultaplaca.rb
Last active October 4, 2017 16:21
Consulta de informações básicas sobre veículos através da placa utilizando o sistema Sinesp Cidadão.
require "uri"
require "net/http"
require 'base64'
require 'cgi'
require 'openssl'
HOST_KEY = "shienshenlhq"
def search_plate plate
hmac = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), HOST_KEY.encode("ASCII"), plate.encode("ASCII"))
@ronanrodrigo
ronanrodrigo / darkenColor.swift
Created February 18, 2016 22:00
Darken color
func darkenColor(color: NSString, amount: Float) -> (hexColor: String, color: NSColor) {
let originalRed = Float(Int(color.substringWithRange(NSRange(location: 0, length: 2)), radix: 16)!)
let originalGreen = Float(Int(color.substringWithRange(NSRange(location: 2, length: 2)), radix: 16)!)
let originalBlue = Float(Int(color.substringWithRange(NSRange(location: 4, length: 2)), radix: 16)!)
let valueRed = originalRed * amount
let darkenRed = String(format: "%02X", Int(valueRed))
let valueGreen = originalGreen * amount
let darkenGreen = String(format: "%02X", Int(valueGreen))
protocol NewCustomerForm {
var enteredName: String? { get }
var enteredEmail: String? { get }
var enteredPhone: String? { get }
var enteredAddress: String? { get }
}
class NewCustomerViewController: UIViewController, NewCustomerForm {
// MARK: Outlets