20 random bookmarks
Тут будут ссылки на всё-всё, что я найду интересным
Тут будут ссылки на всё-всё, что я найду интересным
// Output the k! permutations of A in which the first k elements are permuted in all ways.
// To get all permutations of A, use k := length of A.
//
// If k > length of A, will try to access A out of bounds.
// If k <= 0 there will be no output (empty array has no permutations)
procedure permutations(k : integer, A : array of any):
if k = 1 then
output(A)
else
// permutations with last element fixed
permutations(k - 1, A)
// permutations with last element swapped out
for i := 0; i < k-1; i += 1 do
if k is even then
swap(A[i], A[k-1])
else
swap(A[0], A[k-1])
end if
permutations(k - 1, A)
end for
end if
Experiment 5
Goal: Go 21 straight days without complaining or uttering non-constructive criticism. (If I catch myself doing it, I must start again at day zero.)
This was inspired by Will Bowen’s book A Complaint Free World, in which he claims that if you stop pronouncing your negative thoughts, you stop having those kinds of thoughts, and that if everyone did this the world would change completely.
What happened: It took 55 days to get 21 complaint-free days in a row, but I did it. This experiment really does teach you not to complain, and I think everyone should do it once in their lives. But it didn’t create much of an inner change. My negative thoughts were unaffected, I just got more polite about whether to pass them on to others. Complaining can even be a worthwhile form of bonding, as I learned while I was working a painful manual labor job with new friends, and could never join in on the lighthearted griping. Still, it’s better to never complain than to complain freely.
Where I am with it today: Even though the exercise didn’t eliminate internal negativity like the book promised, the experiment left me much more conscious about expressing needless negativity, and I am pretty good at keeping it to myself most of the time. I’m also more patient with others when they’re complaining. This is one experiment I would recommend to almost anybody.
A - The task requirements and goals might not be clear enough. If you are trying to get yourself to “plan for a project” or “write a book” then it’s hard to identify the next actionable items. Put some time aside to figure out what physical things you can do to move the project forward. Try break down the larger tasks into the smallest pieces possible. The goal of the project might need identifying, or the requirements fleshed out from a supervisor.
B - The task might exceed your current competency. Sometimes we know what we have to do, but don’t know how to do it, and then we become avoidant rather than admitting this. In this case, it’s worth figuring out what you do know how to do and what you don’t know how to do, and be honest with that. Then slowly ask for help or read up on the things you don’t know.
C - The tasks might really not be worth it. Sometimes you are assigned tasks that don’t actually help you achieve your long-term goals, and so your brain demotivate you from doing them. Maybe the payoff is low, maybe you don’t learn anything new from them, or maybe a colleague you don’t like will gain credit for the tasks, or maybe you just wont be rewarded or appreciated for getting the tasks done.
Психополитика – это совокупность властных инструментов управления неолиберальным «субъектом достижений», основанных на императиве «ты можешь», самодисциплине и самостимуляции для повышения эффективности в стремлении к новым свершениям, что мотивируется идеей о том, что каждый человек – предприниматель самого себя и жизнь каждого должна стать успешным экономическим проектом.
Бесит, что всё больше подкастов монтируют и оформляют всякими джинглами, перебивками и эффектами. Такое ощущение, что туда понаприходили люди с радио и телевидения, которые не понимают, как устроен интернет, и притащили с собой весь эфирный мусор. Причём многие слушатели, кто открывают для себя подкасты только в последнее время, думают, что так и надо, и не видят в этом абсурда — другого-то они не слышали!
package src
type config struct {
// Required
foo, bar string
// Optional
fizz, bazz int
}
// Each optional configuration attribute will have its own public method
func (c *config) WithFizz(fizz int) *config {
c.fizz = fizz
return c
}
func (c *config) WithBazz(bazz int) *config {
c.bazz = bazz
return c
}
// This only accepts the required options as params
func NewConfig(foo, bar string) *config {
// First fill in the options with default values
return &config{foo, bar, 10, 100}
}
func Do(c *config) {}
You’d use the API as follows:
package main
import ".../src"
func main() {
// Initialize the struct with only the required options and then chain
// the option methods to update the optional configuration attributes
c := src.NewConfig("hello", "world").WithFizz(0).WithBazz(42)
src.Do(c)
}
This idea is pretty simple, in principle: sometimes we miss a good-enough solution because a not-quite-good-enough solution is already out there and in use.
Бывает, вы с приятелем пришли в кафе, и он у вас спрашивает, какой тут пароль от вайфая. У вас подключен компьютер, потому что вы тут были год назад, но пароль вы не помните.
Беру любой JSON и вижу, как его можно упростить, убрав лишнюю вложенность. Вдвойне обидно, что на эту вложенность кто-то тратил время, а она не нужна!
Functions that are part of your project’s source code but can never be
reached in any execution are called “dead code”, and they exert a drag
on codebase maintenance efforts.
Today we’re pleased to share a tool named deadcode to help you identify them.
Minimizing your keyboard layout is a slippery slope.
34-keys has been reasonably comfortable to use, for both prose and program. My palms do not move across the desk at all, as I reach for keys. I mostly write Rust and Bash, and my layout has evolved to accomodate special characters from their grammars (angled brackets and hyphens, specifically). If you are on a similar journey, I would suggest focusing on accuracy and comfort over speed. Speed comes with time.
This huge collection of non-scary optical illusions and fascinating visual phenomena emphasizes interactive exploration, beauty, and scientific explanation.
If you want a single piece of advice to reduce your bug count, it’s this:
Re-read your code frequently. After writing a few lines of code (3 to 6 lines, a short block within a function), re-read them. That habit will save you more time than any other simple change you can make.
Сайт с заданиями для создания, редактирования, проверки данных ОСМ
Интерактивная карта, которая показывает изохроны пути от выбранной станции Нью-Йоркского метрополитена, используя данные GTFS из Управления городского транспорта Нью-Йорка