This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
use core::fmt::Debug; | |
use clap::Parser; | |
use serde_with::{DeserializeFromStr, SerializeDisplay}; | |
#[derive(Clone, SerializeDisplay, DeserializeFromStr)] | |
pub struct NoDisplay(String); | |
impl std::fmt::Display for NoDisplay { | |
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"meta": { | |
"theme": "elegant" | |
}, | |
"basics": { | |
"name": "Hugo Ferreira de Almeida", | |
"label": "Software Engineer", | |
"picture": "", | |
"email": "hugofalmeida@gmail.com", | |
"phone": "(+81) 80-2200-3766", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fetcher file | |
const handleErrors = async (...myargs) => { | |
const response = await originalFetch(...myargs); | |
if (!response.ok) { | |
throw Error(response.statusText); | |
} | |
return response; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//client side | |
match({ routes, location }, (error, redirectLocation, renderProps) => { | |
render( | |
<Provider store={store}> | |
<ContextHolder context={context}> | |
<Router {...renderProps} children={routes} history={Location} /> | |
</ContextHolder> | |
</Provider>, | |
appContainer | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//client side | |
const { pathname, search, hash } = window.location; | |
const location = `${pathname}${search}${hash}`; | |
match({ routes, location }, (error, redirectLocation, renderProps) => { | |
console.log(renderProps); | |
console.log(location); | |
render( | |
<Provider store={store}> | |
<ContextHolder context={context}> | |
<Router {...renderProps} children={routes} history={Location} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
has_many :combo_instances | |
end | |
class ComboGame < ActiveRecord::Base | |
has_many :combo_instances | |
attr_reader :game_result | |
validates :hits_required, presence: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the_password = 'DO_NOT_USE_THIS_PASSWORD' | |
pem_key_with_password = OpenSSL::PKey::RSA.new(2048).to_pem(OpenSSL::Cipher.new('aes-256-gcm'), the_password) | |
loaded_key = OpenSSL::PKey::RSA.new(pem_key_with_password, the_password) | |
boom! | |
OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key: nested asn1 error | |
from (irb):34:in `initialize' | |
from (irb):34:in `new' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'active_model_serializers', github: 'rails-api/active_model_serializers', branch: '0-10-stable' | |
class Item | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
end | |
def index | |
render json: Item.all | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise = require 'bluebird' | |
methodB = -> | |
p = new Promise (resolve, reject)-> | |
setTimeout -> | |
console.log 'doing methodB' | |
reject Error('failed b') | |
, 1000 | |
p.error (e)-> | |
console.log 'log error to methodB.log' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise = require 'bluebird' | |
methodB = -> | |
p = new Promise (resolve, reject)-> | |
setTimeout -> | |
console.log 'doing methodB' | |
reject 'failed b' | |
, 1000 | |
p.catch (e)-> | |
console.log 'log error to methodB.log' |
NewerOlder