This is a generic guidline that applies mostly to Ruby on Rails and Postgres, but can be usefull for running any database migrations in CI.
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
module Uu58 | |
# Convert a string UUID to a base58 string representation. | |
# | |
# Output will be padded up to 22 digits if necessary. | |
# | |
# Behaviour is undefined if passing something other than a 128-bit | |
# hex string in network order with optional interstitial hyphens. | |
def self.uuid_to_base58(uuid, alphabet = SecureRandom::BASE58_ALPHABET) | |
ary = uuid.delete("-").to_i(16).digits(58).reverse | |
ary.unshift(0) while ary.length < 22 |
Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.
The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.
<script>
// require vue-resource...
new Vue({
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
{ | |
"Items": [ { | |
"TemplateId": "BADGE_BATTLE_ATTACK_WON", | |
"Badge": { | |
"BadgeType": "BADGE_BATTLE_ATTACK_WON", | |
"BadgeRanks": 4, | |
"Targets": "\\nd\\350\\007" | |
} | |
}, { | |
"TemplateId": "BADGE_BATTLE_TRAINING_WON", |
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
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |