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
# prevent core:copy if and only if there's one selection in | |
# the active editor (mini or not) and its length equals 0 | |
atom.commands.add 'atom-text-editor', 'core:copy', (e) -> | |
editor = e.currentTarget.getModel() | |
# do nothing if there's more than 1 selection | |
return if editor.getSelectedBufferRanges().length > 1 | |
# get the starting and ending points of the selection | |
{start, end} = editor.getSelectedBufferRange() |
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
Python (3) to (Common) Lisp feature comparison | |
Memory model & typing: | |
CL & Python are both managed-memory languages. | |
Both are also dynamically-typed languages with strong type systems (no implicit type coercion), although Python's design leans toward "duck" typing, and CL's does not. |
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
(macrolet ((addiv (d) | |
`(if (gethash ,d table) | |
(incf (gethash ,d table)) | |
(setf (gethash ,d table) 1)))) | |
(defun %decompose (n table) | |
(cond | |
((= n 1) table) | |
((<= n 3) (addiv n) | |
table) | |
((evenp n) (addiv 2) (%decompose (/ n 2) table)) |
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
;;; You probably wan to add some types to all of this. But later. | |
(defun check-collision (item-a item-b) | |
(and | |
(< (gamekit:x (pos item-a)) (+ (gamekit:x (pos item-b)) (gamekit:x (size item-b)))) | |
(< (gamekit:y (pos item-a)) (+ (gamekit:y (pos item-b)) (gamekit:y (size item-b)))) | |
(> (+ (gamekit:x (pos item-a)) (gamekit:x (size item-a))) (gamekit:x (pos item-b))) | |
(> (+ (gamekit:y (pos item-a)) (gamekit:y (size item-a))) (gamekit:y (pos item-b))))) | |
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
#pragma once | |
#include <initializer_list> | |
#include <algorithm> | |
#include <deque> | |
#include <memory> | |
struct Block { | |
int& operator[](size_t index) { | |
return data_[index + start_]; |
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
Deque has constructors | |
------------------------------------------------------------------------------- | |
/home/aun/SDA/shad-cpp0/deque/test.cpp:23 | |
............................................................................... | |
/home/aun/SDA/shad-cpp0/deque/test.cpp:23: FAILED: | |
{Unknown expression after the reported line} | |
due to a fatal error condition: | |
SIGSEGV - Segmentation violation signal |
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
==8770==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000420 at pc 0x564675a30975 bp 0x7fff37d52420 sp 0x7fff37d52418 | |
READ of size 8 at 0x602000000420 thread T0 | |
#0 0x564675a30974 in std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<Block*> >, std::is_move_constructible<Block*>, std::is_move_assignable<Block*> >::value, void>::type std::swap<Block*>(Block*&, Block*&) (/home/aun/SDA/shad-cpp0/asan_build/test_deque+0x579974) | |
#1 0x564675a2cfcf in std::unique_ptr<Block, std::default_delete<Block> >::reset(Block*) (/home/aun/SDA/shad-cpp0/asan_build/test_deque+0x575fcf) | |
#2 0x564675a29815 in std::unique_ptr<Block, std::default_delete<Block> >::operator=(std::unique_ptr<Block, std::default_delete<Block> >&&) (/home/aun/SDA/shad-cpp0/asan_build/test_deque+0x572815) | |
#3 0x564675a277ab in Deque::Reserve(unsigned long) (/home/aun/SDA/shad-cpp0/asan_build/test_deque+0x5707ab) | |
#4 0x564675a27b81 in Deque::Realloc() (/home/aun/SDA/shad-cpp0/asan_build/test_deque+0x570b81) | |
# |
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
#pragma once | |
#include <memory> | |
#include </home/aun/SDA/shad-cpp0/scheme-tokenizer/tokenizer.h> | |
enum class Types { cellType, numberType, symbolType }; | |
class Object { | |
public: |
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
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <utility> | |
template <class T, class Predicate> | |
class Heap { | |
public: | |
void Heapify(size_t position) { | |
size_t left_pos = Left(position); |
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
#pragma once | |
#include <memory> | |
class Any { | |
public: | |
Any() = default; | |
template <class T> | |
Any(T value) : ptr_(std::make_unique<Derived<T>>(std::move(value))) { |
OlderNewer