Skip to content

Instantly share code, notes, and snippets.

@abzeede
abzeede / sitemap
Last active August 27, 2020 02:26
web_knowledge
What're the benefits of Sitemap, answer by google engineer
- https://webmasters.stackexchange.com/questions/4803/the-sitemap-paradox
@abzeede
abzeede / download_pdf_axios.js
Last active May 19, 2023 14:37
download pdf file with axios
export const getPdfInvoice = async () => {
let csrfToken = document.getElementsByName('csrf-token')[0].content
try {
const resp = await axios.get('ENDPOINT', {
responseType: 'blob',
})
// create temp download url
const downloadUrl = window.URL.createObjectURL(resp.data)
@abzeede
abzeede / sass-resources-loder-webpacker.js
Created April 15, 2020 13:43
config webpacker to support sass-resources-loder
// config/webpack/environment.js
const { environment } = require('@rails/webpacker')
const {
resolved_paths: includePaths,
} = require('@rails/webpacker/package/config')
const getStyleRule = require('@rails/webpacker/package/utils/get_style_rule')
environment.loaders.delete('sass')
environment.loaders.insert(
### Get all character after START_WITH
(?<=^START_WITH)(.*)
@mixin for-phone-s-only {
@media (max-width: 320px) {
@content;
}
}
@mixin for-phone-only {
@media (max-width: 500px) {
@content;
}
header missing
https://github.com/castwide/vscode-solargraph/issues/78#issuecomment-552675511
// inital app
const app = new PIXI.Application({
width: window.innerWidth, // set app width
height: window.innerHeight, // set app height
antialias: true,
transparent: false,
resolution: 1
});
// make background green
@abzeede
abzeede / jsconfig.json
Created August 7, 2019 07:50
setup vscode for relative path goto
{
// This file is required for VSCode to understand webpack aliases
"compilerOptions": {
// This must be specified if "paths" is set
"baseUrl": ".",
// Relative to "baseUrl"
"paths": {
"@/*": ["./src/*"],
}
}
const availableSteps = [1, 4, 5]
function findTotalAvailablePath(prevStep, n) {
let totalPath = 0
availableSteps.map((step) => {
const nextStep = step + prevStep
if (nextStep === n) {
totalPath++
} else if (nextStep < n) {
totalPath += findTotalAvailablePath(nextStep, n)