- Enable Hyper-V:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
- Reboot.
// <https://dev.to/jorik/country-code-to-flag-emoji-a21> | |
function getFlagEmoji(countryCode) { | |
const codePoints = countryCode | |
.toUpperCase() | |
.split('') | |
.map(char => 127397 + char.charCodeAt()); | |
return String.fromCodePoint(...codePoints); | |
} |
const array = [1, 2, 3, 4, 5]; | |
array.groupBy((num, index, array) => { | |
return num % 2 === 0 ? 'even': 'odd'; | |
}); | |
// => { odd: [1, 3, 5], even: [2, 4] }> | |
const odd = { odd: true }; | |
const even = { even: true }; |
org = Organization.find(…) # <- Whatever magic do you use... | |
require 'stripe' | |
hackertime = Date.new(2021,11,1).to_time.to_i # <- It's just unix time, but it's the name front end guys do | |
Stripe.api_key = org.stripe_api_key # <- Your model should rock this way (auto region switch you known) | |
invoices = Stripe::Invoice.list({ "customer": org.stripe_customer_key, "created": { "gte": hackertime }}) |
You can clone the wiki of your github project via ssh:
git clone git@github.com:YOUR_USERNAME/YOUR_REPOSITORY.wiki.git
# From: | |
# https://www.danott.co/posts/seeding-development-with-test-fixtures/ | |
def load_fixtures | |
Rake::Task["db:fixtures:load"].invoke | |
end | |
load_fixtures |
## | |
# Minimal adjustment to time_ago_in_words to add "ago" for past times or prepend "in" for future. | |
# | |
# Sample output: "in 8 days / in about 24 hours / 11 days ago" | |
# | |
def time_diff_in_words(date) | |
return '' unless date | |
words = time_ago_in_words(date) | |
return "#{words} ago" if date < Date.today |
## | |
# Search and Filter Rails Models Without Bloating Your Controller | |
# <https://www.justinweiss.com/articles/search-and-filter-rails-models-without-bloating-your-controller/> | |
# | |
# == Usage: | |
# | |
# In a model like `app/models/product.rb`: | |
# ``` | |
# class Product | |
# include Filterable |
export function qsParam(name) { | |
return new URLSearchParams(document.location.search).get(name); | |
} |
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'toGb' | |
}) | |
export class ToGbPipe implements PipeTransform { | |
transform(value: number, args?: any): string { | |
return (value / 1073741824).toFixed(2).toString(); | |
} | |
} |