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
| // only for desktop for now, | |
| @media screen and (min-width: 1008px) { | |
| /* during entering and leaving : */ | |
| .page-enter-active, .page-leave-active { | |
| position:absolute; | |
| max-width:725.328px; /*make sur our content keep it's original width*/ | |
| transition: all .2s ease; | |
| } |
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
| <!-- | |
| If you really like to use apolloClient declaratively, here is a naive implementation | |
| of a custom 'ApolloQuery' component | |
| --> | |
| <template> | |
| <div> | |
| <slot name="result" :result="this.result" /> | |
| </div> | |
| </template> |
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
| /** | |
| * Usage in a component: | |
| * | |
| * import useApiRequest from "@/composables/useApiRequest" | |
| * | |
| * const saveRequest = useApiRequest("https://jsonplaceholder.typicode.com/userse"); | |
| * function handleFormSubmit() { | |
| * saveRequest.execute() | |
| * } | |
| */ |
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
| <script setup lang="ts"> | |
| import { ref, watch, watchEffect } from "vue"; | |
| const price = ref(10); | |
| const quantity = ref(1); | |
| watchEffect(() => { | |
| console.log("watchEffect()", price.value, quantity.value); | |
| }); |
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 React, { useState, useEffect } from "react"; | |
| import ReactDOM from "react-dom"; | |
| import axios from "axios"; | |
| export default function App() { | |
| const [users, setUsers] = useState(null); | |
| useEffect(async () => { | |
| const result = await axios("https://gorest.co.in/public-api/users"); | |
| setUsers(result.data.data); |
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 React from "react"; | |
| import { | |
| BrowserRouter as Router, | |
| Switch, | |
| Route, | |
| Link | |
| } from "react-router-dom"; | |
| export default function App() { | |
| return ( |
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
| const { MongoClient } = require("mongodb"); | |
| let db; | |
| const client = new MongoClient(process.env.MONGO_URL, { | |
| useNewUrlParser: true, | |
| useUnifiedTopology: true, | |
| }); | |
| module.exports = { |
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
| async function graphql({ query, variables }) { | |
| let response = await fetch(process.env.FIREBLOG_GRAPHQL_ENDPOINT, { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json", | |
| Accept: "application/json", | |
| }, | |
| body: JSON.stringify({ | |
| query, | |
| variables, |
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
| const crypto = require("crypto"); | |
| const algorithm = "aes-256-cbc"; | |
| const secretKey = "SECRET_KEY_32_CHARS"; | |
| module.exports = { | |
| encrypt, | |
| decrypt, | |
| }; | |
| // https://attacomsian.com/blog/nodejs-encrypt-decrypt-data |
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
| /** | |
| * Get content from wordpress via REST Api | |
| */ | |
| const config = require('../nuxt.config.js') | |
| const axios = require('axios') | |
| // always call the proxy here : | |
| const endpoint = config.env.proxyApiBaseUrl | |
| /** | |
| * @param {int} perPage : number of post to return per page |
NewerOlder