Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Deep in the code

Javier Villanueva jahvi

👨‍💻
Deep in the code
View GitHub Profile
View Token.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "erc721a/contracts/ERC721A.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
contract Token is ERC721A, ERC721AQueryable {
enum TokenTypes {
None,
Fist,
View .deps...github...OpenZeppelin...openzeppelin-contracts...contracts...access...Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
View .deps...github...OpenZeppelin...openzeppelin-contracts...contracts...access...Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
View Home.vue
<script>
export default {
async asyncData ({ store, route }) {
// ...
// Prefetch CMS data on the server
await store.dispatch('cmsBlock/list', {
filterValues: ['home_banner'] // Array of CMS blocks identifiers on the page
})
}
}
View LeftBanner.vue
<template>
<div
class="offer-container col-xs-12 col-sm-6 pb15"
v-if="data"
>
<router-link :to="localizedRoute(link)">
<div
class="offer"
v-lazy:background-image="image"
>
View NewPromotedOffers.vue
<template>
<section v-if="!singleBanner" class="offers container my30 px15 cl-black">
<div class="row">
<left-banner :identifier="'home_banner'" />
<!-- ... -->
</div>
</section>
</template>
View parser.js
import { parse } from 'node-html-parser';
const root = parse('<ul id="list"><li>Hello World</li></ul>');
console.log(root.firstChild.structure);
// ul#list
// li
// #text
console.log(root.querySelector('#list'));
View PromotedOffers.vue
<template>
<section v-if="!singleBanner" class="offers container my30 px15 cl-black">
<div class="row">
<cms-block :identifier="'home_banner'" />
<!-- ... -->
</div>
</section>
</template>
View server-express.js
const express = require('express');
const { middleware } = require('@magento/upward-js');
async function serve() {
const app = express();
const port = 8000;
app.get('/', (req, res) => res.send('Hello from Express!'));
const upwardMiddleware = await middleware(`${__dirname}/upward.yml`);
View getPokemonDetail.graphql
query($pokemonName: String) {
pokemon(name: $pokemonName) {
name
image
types
weight {
minimum
maximum
}
height {