This file contains hidden or 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
/** | |
* All the hours in a day in 12-hour clock format with a defined inverval | |
* | |
* @example | |
* // returns [ | |
* '12:00 AM', | |
* '12:15 AM', | |
* '12:30 AM', | |
* '12:45 AM', | |
* '01:00 AM', |
This file contains hidden or 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
var knex; | |
/** | |
* This module extends the knex query builder with selectDistance method, | |
* The method adds a virtual column to the current query (qb) with the alias as, in which | |
* resides the calculated distance from the geoPoint to the entity.location column. | |
* It also accepts some options parameters like the unit (km | mi) and the decimalPrecision of the result. | |
* Deps: Postgis | |
* @example |
This file contains hidden or 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
@weapons ~w(rock scissors paper)a | |
def rps(user_choice) when is_binary(user_choice), do: is_valid_choice(String.to_atom(user_choice)) | |
def rps(user_choice) when is_atom(user_choice), do: is_valid_choice(user_choice) | |
def rps(user_choice), do: {:lost, "Invalid type!"} | |
defp is_valid_choice(user_choice) when user_choice in @weapons, do: time_to_play(user_choice) | |
defp is_valid_choice(user_choice), do: {:lost, "Invalid choice!"} | |
defp time_to_play(user_choice) do |
This file contains hidden or 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
defmodule CryptoSystem do | |
def encrypt(text, key_seed) do | |
words = String.split(text, " "); | |
words | |
|> Enum.with_index() | |
|> Enum.map(&encrypt_word(&1, key_seed)) | |
|> Enum.join(" ") | |
end |
This file contains hidden or 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
// index.html | |
// embed code | |
<script type="text/javascript" id="hs-script-loader" async defer src="//online-script.com/script-loader/XXXX.js"></script> | |
// online-script.com/script-loader/XXXX.js | |
(function (id, src) { | |
if (document.getElementById(id)) { return; } | |
var js = document.createElement('script'); | |
js.src = src; | |
js.type = 'text/javascript'; |
This file contains hidden or 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
# src/api/auth/passport/jwt.strategy.ts | |
import { ExtractJwt, Strategy } from 'passport-jwt'; | |
import { PassportStrategy } from '@nestjs/passport'; | |
import { Injectable } from '@nestjs/common'; | |
import { ConfigService } from 'src/api/config/config.service'; | |
import { UsersProvider } from 'src/api/users/users.provider'; | |
import { JwtService } from '@nestjs/jwt'; | |
@Injectable() |
This file contains hidden or 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
document.addEventListener('DOMContentLoaded', function() { | |
console.log('loading zendesk form builder'); | |
let REPORT_BUG_ARTICLE_ID = '6509556532759'; | |
let REPORT_BUG_TICKET_ID = '6504444995991'; | |
let CONTACT_US_ARTICLE_ID = '6510266315671'; | |
let CONTACT_US_TICKET_ID = '5754824917015'; | |
let FORM_PARENT_ID = 'request-form'; |
This file contains hidden or 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
(function () { | |
const selectorToFloat = (selector) => parseFloat(document.querySelector(selector).textContent.trim().replace(',', '.')); | |
const floatToLocaleString = (number) => number.toLocaleString('es-UY', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); | |
const dolares = prompt('¿Cuántos dólares desea comprar?'); | |
const compra = selectorToFloat('table > tbody > tr:nth-child(2) > td:nth-child(3)'); | |
const venta = selectorToFloat('table > tbody > tr:nth-child(2) > td:nth-child(5)'); | |
const media = parseFloat(((compra + venta) / 2).toFixed(2)); | |
const pesos = parseFloat((dolares * media).toFixed(2)); |
This file contains hidden or 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
<template> | |
<div> | |
<div :class="{'new-feature': isFeatureActive, 'old-feature': !isFeatureActive}"> | |
<!-- Content goes here when MILESTONE_NEW_FEATURE_ENABLED is enabled/disabled --> | |
<button @click="fetchData">Fetch Data</button> | |
<div v-if="apiData">{{ apiData }}</div> | |
</div> | |
<p>{{ computedMessage }}</p> | |
</div> |
This file contains hidden or 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
import { createStore } from 'vuex'; | |
import axios from 'axios'; | |
import { featureFlagProvider } from '@/lib/featureFlag'; | |
export default createStore({ | |
state: { | |
products: [], | |
}, | |
mutations: { | |
SET_PRODUCTS(state, products) { |
OlderNewer