Skip to content

Instantly share code, notes, and snippets.

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

Alisson Bruno alissonbrunosa

🏠
Working from home
View GitHub Profile
Warming up --------------------------------------
lists 14.525k i/100ms
select 8.124k i/100ms
pluck 258.000 i/100ms
Calculating -------------------------------------
lists 157.648k (± 7.4%) i/s - 798.875k in 5.096596s
select 85.202k (± 7.1%) i/s - 430.572k in 5.079725s
pluck 2.414k (± 9.8%) i/s - 12.126k in 5.072495s
Comparison:
package solution
// You are given an array A consisting of N integers.
// For each number A[i] such that 0 ≤ i < N, we want to count the number of elements of the array that are not the divisors of A[i]. We say that these elements are non-divisors.
// For example, consider integer N = 5 and array A such that:
// A[0] = 3
// A[1] = 1
module Chainable
def chain(*methods)
chain!(*methods)
rescue NoMethodError
nil
end
def chain!(*methods)
methods.inject(self) do |object, method|
object.public_send(method)
require 'sinatra'
require 'securerandom'
module OS
class << self
def get
linux || mac || windows
end
import React from 'react';
let {Component, PropTypes} = React;
export default class CoolComponent extends Component {
handler = (e) => {
// Do somthing cool here
}
render() {
return <div onClick={this.handler}></div>;
$.ajax({
url: 'url-chamada',
success: function(a,b,c) {
// Do something if sucess
},
statusCode: {
401: function() {
//Do something if status code is 401.
}
}
class RegistrationsController < Devise::RegistrationsController
before_action :configure_sign_up_params, only: [:create]
protected
def configure_sign_up_params
attributes = { pessoa_attributes: [:nome, :cpf, :telefone, :data_nascimento, :sexo] }
devise_parameter_sanitizer.for(:sign_up) << attributes
end
end