Search By Label
kubectl get deployments
: List all the running deployments.kubectl describe deployment <deploy name>
: Print out details about a specific deploymentkubectl apply -f <config file name>
: Create a deployment out of a config file.kubectl delete deployment <deploy name>
: Delete a deploykubectl rollout restart deployment <deploy name>
: Restart all pods created by deployment.restartPolicy
is set to Never
or OnFailure
.SUM
and get decimals complementing with numeric
in the following way:select us.product_id, ROUND(SUM(us.units * p.price)::numeric / SUM(us.units), 2) AS average_price from Prices p left join UnitsSold us on us.product_id = p.product_id and us.purchase_date between p.start_date and p.end_date group by us.product_id order by us.product_id
export const displayRoute = (route: string, t: (key: string) => string): string => { const accountDetailRegex = /^\/accounts\/[0-9a-fA-F-]{36}$/;
if (accountDetailRegex.test(route)) return t('accountDetails'); };
customer_id
and name
product_id
and name
SELECT customers.customer_id, customers.name, products.product_id, products.name FROM customers CROSS JOIN products;
.replace()
to match everything from the start of your string up until the first dot .
, and replace that with an empty string.var str = "P001.M003.PO888393";
var res = str.replace(/^[^\.]*\./, '');
console.log(res);
#=> M003.PO888393
arr = new Array(3).fill(0)
docker push NAME[:TAG]
docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
docker tag 518a41981a6a myRegistry.com/myImage
GET
request expresses the user's intent to not have any side effects. Naturally, there will always be side effects on the server like log entries for example, but the important distinction here is whether the user had asked for a side effect or not.GET
surfaces if you respond with the recommended 201 Created
response for a request where the resource is being created on the server. The next request would result in a different response with status 200 OK
and thus it cannot be cached as is usually the case with GET
requests.The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.
If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem.
409 Conflict
in case an update would result in a different state.then
or catch
.// Add a request interceptor axios.interceptors.request.use(function (config) { // Do something before request is sent return config; }, function (error) { // Do something with request error return Promise.reject(error); }); // Add a response interceptor axios.interceptors.response.use(function (response) { // Any status code that lie within the range of 2xx cause this function to trigger // Do something with response data return response; }, function (error) { // Any status codes that falls outside the range of 2xx cause this function to trigger // Do something with response error return Promise.reject(error); });
usePathname
is a Client Component hook that lets you read the current URL's pathname.'use client' import { usePathname } from 'next/navigation' export default function ExampleClientComponent() { const pathname = usePathname() return <p>Current pathname: {pathname}</p> }
usePathname
intentionally requires using a Client Component. It's important to note Client Components are not a de-optimization. They are an integral part of the Server Components architecture.<Link key={link.name} href={link.href} className={clsx( 'flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3', { 'bg-sky-100 text-blue-600': pathname === link.href, }, )} > <LinkIcon className="w-6" /> <p className="hidden md:block">{link.name}</p> </Link>
debugger
statement directly in your Node code to create breakpoints. When the Node runtime hits the debugger
statement, it will pause execution if a debugger is attached.function exampleFunction() { const value = 42; debugger; // Execution will pause here if a debugger is attached console.log(value); } exampleFunction();
--inspect
or --inspect-brk
flag when running your app.node --inspect --5120 lib/app.js
Debugger listening on ws://127.0.0.1:9229/65b96f6d-6202-49db-bbe8-63b706a580a2