This file contains 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
function cons(x, y) { | |
return function(w) { return w(x, y) }; | |
}; | |
function car(z) { | |
return z(function(x, y) { return x }); | |
}; | |
function cdr(z) { | |
return z(function(x, y) { return y }); |
This file contains 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 { apiClient, REACT_QUERY_KEYS } from '@/config' | |
import { getErrorMessage } from '@/utils/utils' | |
import { useMutation, useQueryClient } from '@tanstack/react-query' | |
import { useRouter } from 'next/router' | |
import { toast } from 'react-toastify' | |
export const useDeleteDevice = ({ | |
isOnDeviceListPage, | |
callbackOnSuccess, | |
}: { |
This file contains 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
-module(words). | |
-export([strlen/1]). | |
%Assignment: Write a function that uses recursion to return the number of words in a string. | |
% If we send an empty list, return 0. | |
strlen([]) -> 0; | |
%Entry point for this module | |
strlen(Sentence) -> count(Sentence, 1). | |
%Base case. When its finally empty return the sum count. | |
count([], Count) -> Count; |
This file contains 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
// Add a 401 response interceptor | |
window.axios.interceptors.response.use(function (response) { | |
return response; | |
}, function (error) { | |
if (401 === error.response.status) { | |
swal({ | |
title: "Session Expired", | |
text: "Your session has expired. Would you like to be redirected to the login page?", | |
type: "warning", | |
showCancelButton: true, |
This file contains 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
//// Demo of render props pattern in React | |
//// Provider pattern in Emberjs (https://guides.emberjs.com/release/tutorial/part-2/provider-components/) | |
import React from 'react'; | |
import './style.css'; | |
const RentalsFilter = ({ rentals, query, render }) => { | |
const filteredRentals = React.useMemo(() => { | |
if (query) { | |
rentals = rentals.filter((rental) => rental.title.includes(query)); |
This file contains 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
noremap f e | |
noremap p r | |
noremap b t | |
noremap j y | |
noremap l u | |
noremap u i | |
noremap y o | |
noremap ' p | |
noremap r s | |
noremap s d |
This file contains 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
type TemplateType = { | |
template: string; | |
id: string; | |
}; | |
function withTemplate(templateObj: TemplateType) { | |
return function (constructor: any) { | |
let el = document.getElementById(templateObj.id); | |
let p = new constructor(); | |
if (el) { |
This file contains 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
// send POST request to /wp-json/jwt-auth/v1/token voi data | |
{ | |
"username" : "admin", | |
"password": "123456" | |
} | |
// ket qua nhan ve se gom truong token |
NewerOlder