Skip to content

Instantly share code, notes, and snippets.

💭
Using github

Alex Ozer alexozer

View GitHub Profile
View sane-headings2.el
(defun ozer/new-heading (default-enter open-below)
(if (org-at-heading-p)
;; Enter once will make new heading, twice will clear
(if (string= (org-entry-get nil "ITEM") "")
(evil-change (line-beginning-position) (line-end-position))
;; Insert a new TODO if we're on a TODO
(if (org-get-todo-state)
(org-insert-todo-heading-respect-content)
(org-insert-heading-respect-content)
)
View sane-headings.el
(defun ozer/new-org-heading (default-enter)
(if (org-at-heading-p)
;; Enter once will make new heading, twice will clear
(if (eq (org-entry-get nil "ITEM") "")
(evil-change (line-beginning-position) (line-end-position))
;; Insert a new TODO if we're on a TODO
(if (org-get-todo-state)
(org-insert-todo-heading-respect-content)
(org-insert-heading-respect-content)
)
View gist:85dfb977c24e13a27e08e8a5fd372525
/* Copyright 2015-2017 Jack Humbert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
View gist:faccfb7e720d41de2e572baaa16661c3
def has_won(self, player):
mark = player.mark
size = len(self.board)
return (
any(all(slot == mark for slot in row) for row in self.board) or
any(all(row[col_idx] == mark for row in self.board) for col_idx in range(size)) or
all(self.board[i][i] == mark for i in range(size)) or
all(self.board[i][size - i - 1] for i in range(size))
)
View gist:15b6b08b4c8d5eec19bcb7e6960493c9
def has_won(self, player):
mark = player.mark
size = len(self.board[0])
horiz = any(all(slot == mark for slot in row) for row in self.board)
vert = any(all(row[col_idx] == mark for row in self.board) for col_idx in range(size))
diag1 = all(self.board[i][i] == mark for i in range(size))
diag2 = all(self.board[i][size - i - 1] for i in range(size))
return horiz or vert or diag1 or diag2
View gist:57bc1d0a0ac2bbbc22562bc317e3b059
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
View gist:f1d30ec121c4c59dabf783a29283d941
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
View gist:f3d5704c11d9a79c03b294fad5e5648f
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
You can’t perform that action at this time.