Skip to content

Instantly share code, notes, and snippets.

View fermartz's full-sized avatar

Fer Martinez fermartz

View GitHub Profile
import Bool "mo:base/Bool";
import Int "mo:base/Int";
import Nat "mo:base/Nat";
actor {
// *************************
// *** CODING CHALLENGES ***
import Int "mo:base/Int";
actor {
// *************************
// *** MIN MAX FUNCTIONS ***
// *************************
public func get_min_value(x : Int, y : Int) : async Int {
@fermartz
fermartz / counter.mo
Last active January 16, 2023 18:20
Motoko Counter
actor {
var count : Int = 0;
public func increment() : async () {
count += 1;
};
public query func get_value() : async Int {
count;
@fermartz
fermartz / greeting.mo
Last active January 16, 2023 18:20
Motoko Greeting
actor {
public func greeting( i : Text) : async Text {
"Hello, there " # i # "!!!";
};
};
@fermartz
fermartz / single_file.js
Created May 18, 2022 12:50
Single file solution for vite config
// This file tells vite config that we don't want code splitting
const defaultConfig = {
useRecommendedBuildConfig: true,
removeViteModuleLoader: false,
}
export function viteSingleFile({
useRecommendedBuildConfig = true,
removeViteModuleLoader = false,
} = defaultConfig) {
return {
const scrollTo = (goTo, offset = 0, goToNumber = 0, time = 600) => {
var target = document.querySelectorAll(goTo)[goToNumber]
var targetPosition = target.offsetTop - offset
var startPosition = window.scrollY
var distance = targetPosition - startPosition
var duration = time
var startTime = null
function animationScroll(currentTime) {
if (startTime === null) startTime = currentTime