This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
import { NextResponse } from 'next/server' | |
import type { NextRequest } from 'next/server' | |
export function middleware(req: NextRequest) { | |
// get cookie token | |
const hasToken = req.cookies.get('token') | |
// protected routes (admin routes) | |
if (req.nextUrl.pathname.startsWith('/admin')) { | |
if (hasToken) { |
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
More recent resolution: | |
1. cd ~/../../etc (go to etc folder in WSL). | |
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line). | |
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line). | |
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian). | |
5. cd ~/../../etc (go to etc folder in WSL). | |
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file). | |
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and | |
secondary. |
import requests | |
import os | |
import logging | |
# Local file that contains API keys and secrets | |
from config import Config | |
# create logger | |
logger = logging.getLogger(__file__) | |
logger.setLevel(logging.DEBUG) |
#!/bin/bash | |
## RECOMENDO EXECUTAR ESSE SCRIPT NA PASTA DOCUMENTOS DENTRO DO USUARIO | |
echo "PRECISA DE INTERNET PARA EXECUTAR ESSE SCRIPT" | |
echo "FAZ DOWNLOAD DE ARQUIVOS NA NET" | |
sudo su | |
apt-get update -y |
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz |
FROM ruby:2.3 | |
# Set the base directory used in any further RUN, COPY, and ENTRYPOINT | |
# commands. | |
RUN mkdir -p /app | |
WORKDIR /app | |
# Copy dependencies into the container | |
COPY Gemfile Gemfile.lock ./ | |
RUN gem install bundler && bundle install --jobs 20 --retry 5 --without development test |
<script type="text/javascript"> | |
/* in order to update info on your checkout page you need to trigger update_checkout function | |
so add this in your javascript file for your theme or plugin | |
*/ | |
jQuery('body').trigger('update_checkout'); | |
/* what this does is update the order review table but what it doesn't do is update shipping costs; | |
the calculate_shipping function of your shipping class will not be called again; | |
so if you were like me and you made a shipping method plugin and you had to change costs based on payment method then |