Skip to content

Instantly share code, notes, and snippets.

@azimin
azimin / [Quiz] CocoaHeads Russia, St. Petersburg, December 2016
Last active December 24, 2017 15:50
Quiz from CocoaHeads Russia meeting in Saint Petersburg (December 2016)
CocoaHeads Russia December Quiz
Пожалуйста указывайте авторство
Все вопросы, жалобы и уточнения можно на писать мне в одной из социальных сетей:
https://vk.com/azimin
https://twitter.com/ziminalex
https://facebook.com/AllZimin
Ответы в конце файла.
@andymatuschak
andymatuschak / States-v3.md
Last active May 12, 2025 06:11
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@strizhechenko
strizhechenko / shell.md
Last active July 6, 2020 12:05
Программа для underhood.ko

Опции bash для разработки

Разрабатывайте скрипты с опциями set -eu

  • set -e - падать на ошибках
  • set -u - считать ошибкой обращение к неопределенной переменной
  • set -o pipefail - заставить пайпы перестать скрывать ошибки предыдущих команд

Профиты

  • максимально быстрое выявление скрытых ошибок в коде.
  • не надо самому писать многие проверки значений.
  • Это сделает shell-код похожим на нормальный язык программирования, а не на набор последовательно выполняющихся команд, которым на всё пофиг.

Mastering Programming - by Kent Beck

From years of watching master programmers, I have observed certain common patterns in their workflows. From years of coaching skilled journeyman programmers, I have observed the absence of those patterns. I have seen what a difference introducing the patterns can make. Here are ways effective programmers get the most out of their precious 3e9 seconds on the planet. The theme here is scaling your brain. The journeyman learns to solve bigger problems by solving more problems at once. The master learns to solve even bigger problems than that by solving fewer problems at once. Part of the wisdom is subdividing so that integrating the separate solutions will be a smaller problem than just solving them together.

Time

Slicing - Take a big project, cut it into thin slices, and rearrange the slices to suit your context. I can always slice projects finer and I can always find new permutations of the slices that meet different needs

@yig
yig / wrapfigure_without_whitespace.tex
Created May 17, 2016 04:39
Eliminate white space around wrapfigure environments in LaTeX.
%% The typical answer for how to eliminate white space in wrapfigure doesn't work for me (I'm using a SIGGRAPH style sheet):
%% http://tex.stackexchange.com/questions/111393/too-much-space-around-wrap-figure
%% Instead, let's just offset the image.
%% The horizontal white space is \columnsep and the vertical white space is \intextsep.
%% Subtract them from the column width and offset the image accordingly.
%% How to move an image:
%% http://tex.stackexchange.com/questions/107340/how-to-shift-graphics-adjust-placement-of-figure-with-includegraphics
\begin{wrapfigure}[11]{R}{1in - .75\columnsep}
%\centering
\vspace{-\intextsep}
Ну условно говоря:
Модеь: АААА! Давление 1960 на 1230!!!
Viewmodel : состояние лампочки: красное
View; Окей, отобразим ! красным
# и в обратную сторону
(Пользователь жмет педальку)
View : -> ViewModel
Слушай, тут пользователь жмякнул педальку.
#!/bin/sh
#
# Converts branch name 'MAPP-452_how-is-it-going' into a commit message 'MAPP-452 How is it going'
#
if ! [ -z $2 ]
then
if ! [ "message" == $2 ]
then
@gubatron
gubatron / compiling_building_c_cpp_notes.md
Last active April 15, 2025 16:19
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015;

Last update on December 14, 2023

Updated on February 27, 2023

Updated August 29, 2019.

@mkf-simpson
mkf-simpson / uncommitable-hook.sh
Created February 20, 2015 12:39
pre-commit hook to prevent commit when there is a comment «UNCOMMITABLE»
#!/usr/bin/env bash
declare -i ERRORS=0
if git rev-parse --verify HEAD > /dev/null 2>&1
then
AGAINST=HEAD
else
AGAINST=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 20, 2025 21:15
The best FRP iOS resources.

Videos