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
head: { | |
htmlAttrs: { | |
lang: "en-GB", | |
}, | |
title: "Articles focused on learning Laravel and VueJS", | |
meta: [ | |
{ charset: "utf-8" }, | |
{ name: "HandheldFriendly", content: "True" }, | |
{ name: "viewport", content: "width=device-width, initial-scale=1" }, | |
{ |
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
# Stop all containers | |
docker stop `docker ps -qa` | |
# Remove all containers | |
docker rm `docker ps -qa` | |
# Remove all images | |
docker rmi -f `docker images -qa ` | |
# Remove all volumes |
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
# Weighted Moving Average (WMA) | |
# http://en.wikipedia.org/wiki/Moving_average#Weighted_moving_average | |
# | |
# Given a hash, calculates the weighted moving averages of its values within | |
# a window size given. Modifies the original hash values. | |
# | |
# @param hash [Hash] the hash for whom values calculate the weighted moving | |
# averages. | |
# @param maws [Fixnum] the Moving Average Window Size. The greatest this | |
# number is the smoothest the calculated averages will be. |
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
interface MyProgramDSL<T> { | |
read: () => Promise<string>; | |
write: (value: string) => Promise<void> | |
done: (value: T) => Promise<T> | |
} | |
const MyProgram = async ({ read, write, done }: MyProgramDSL<string>) => { | |
await write("Hello, what is your name?"); | |
const name = await read(); |
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
type Program<T> = Read<T> | Write<T> | Done<T>; | |
interface Read<T> { | |
kind: "Read"; | |
next: (data: T) => Program<T>; | |
} | |
interface Write<T> { | |
kind: "Write"; | |
valToWrite: string; |
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
// DONT FORGET TO `yarn add esbuild-loader` !!! | |
// config/webpacker/environment.js | |
const { environment } = require('@rails/webpacker') | |
const { ESBuildPlugin } = require('esbuild-loader') | |
const esBuildUse = [ | |
{ | |
loader: require.resolve('esbuild-loader'), | |
// What you want to compile to, in this case, ES7 |
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
/** | |
* Typescript dynamic class method example | |
* | |
* REFERENCES: | |
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html | |
* @see https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Mixins.md | |
* @see http://blog.brillskills.com/2013/09/exploring-javascript-prototypes-via-typescripts-class-pattern | |
* @see https://github.com/Microsoft/TypeScript/wiki/%27this%27-in-TypeScript | |
* | |
* For this example, using IONIC 2/3 Toast component to override a method |
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 { Module } from '@nestjs/common'; | |
import { MyLibModule } from './my-lib.module'; | |
@Module({ | |
imports: [ | |
MyLibModule.register({ name: 'Enzo' }), | |
] | |
}) | |
export class ImportingModule {} |
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
require 'net/http' | |
def working_url?(url_str) | |
url = URI.parse(url_str) | |
Net::HTTP.start(url.host, url.port) do |http| | |
http.head(url.request_uri).code == '200' | |
end | |
rescue | |
false | |
end |