N88 https://leetcode.com/problems/merge-sorted-array/
var merge = function(nums1, m, nums2, n) {
let lastIdx = m + n - 1;
while (n - 1 >= 0) {
if (nums1[m - 1] > nums2[n - 1]) {
nums1[lastIdx] = nums1[m - 1];
N88 https://leetcode.com/problems/merge-sorted-array/
var merge = function(nums1, m, nums2, n) {
let lastIdx = m + n - 1;
while (n - 1 >= 0) {
if (nums1[m - 1] > nums2[n - 1]) {
nums1[lastIdx] = nums1[m - 1];
require "socket" | |
def handle_client(io) | |
# START LINE: | |
io << "HTTP/1.1 200 OK\r\n" | |
# HEADERS: | |
io << "Content-Type: text/plain\r\n" | |
io << "Transfer-Encoding: chunked\r\n" | |
io << "\r\n" |
require "socket" | |
def handle_client(io) | |
# read request | |
loop do | |
line = io.gets | |
puts line | |
break if line == "" # end of headers section | |
end | |
# we don't read request body for now |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/rosd/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, | |
# to know which specific one was loaded, run: echo $RANDOM_THEME | |
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes |
function coSimple(fn) { | |
let gen = fn(); | |
function next(asyncValue) { | |
let { done, value } = gen.next(asyncValue); | |
let promise = isPromise(value) ? value : Promise.resolve(value); | |
if (done) return promise; |
def user_not_authorized | |
flash[:alert] = 'You are not authorized to perform this action.' | |
can_be_infinite_redirect = request.url == request.referer | |
if can_be_infinite_redirect | |
redirect_to root_path | |
else | |
redirect_back(fallback_location: root_path) | |
end | |
end |
class ApplicationController < ActionController::Base | |
include Pundit | |
protect_from_forgery with: :exception | |
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized | |
private | |
def user_not_authorized |
Можна пошукати приклади тут https://devhints.io/react. Але найтиповіші задачі
import React from 'react'
export default class Hello extends React.Component {
state = {text: 'Hello'}
npm i -D prettier eslint-config-prettier eslint-plugin-prettier
.eslintrc
with this content:{