Skip to content

Instantly share code, notes, and snippets.

View dacap's full-sized avatar
🎨
Programming

David Capello dacap

🎨
Programming
View GitHub Profile
@dacap
dacap / zoom.aseprite-keys
Created August 25, 2015 14:30
Fix Ctrl+ and Ctrl- to zoom in/out
<keyboard version="1">
<commands>
<key command="Zoom" shortcut="Ctrl++ Pad">
<param name="action" value="in" />
</key>
<key command="Zoom" shortcut="Ctrl++">
<param name="action" value="in" />
</key>
<key command="Zoom" shortcut="Ctrl+- Pad">
<param name="action" value="out" />
CelIterator LayerImage::findCelIterator(frame_t frame)
{
auto first = getCelBegin();
auto end = getCelEnd();
first = std::lower_bound(
first, end, nullptr,
[frame](Cel* cel, Cel*) -> bool {
return cel->frame() < frame;
});
<!-- Aseprite -->
<!-- Copyright (C) 2001-2015 by David Capello -->
<gui>
<window id="main_window" noborders="true" desktop="true">
<vbox noborders="true" expansive="true">
<hbox noborders="true" id="menu_bar_placeholder" />
<hbox noborders="true" id="tabs_placeholder" />
<splitter id="color_bar_splitter"
horizontal="true" expansive="true"
by="pixel">
{ "frames": {
"file 0.ase": {
"frame": { "x": 0, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
"file 1.ase": {
@dacap
dacap / file.json
Created September 22, 2015 11:55
{ "frames": [
{
"filename": "file 0.ase",
"frame": { "x": 0, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
@dacap
dacap / test.h
Created September 22, 2015 18:26
#pragma once
#include <cstdlib>
#include <iostream>
template<typename T, typename U>
inline void expect_eq(const T& expected, const U& value,
const char* file, const int line) {
if (expected != value) {
std::cout << file << ":" << line << ": failed\n"
(defun slick-shrink-whitespace ()
"Replaces three Emacs functions in just one:
- Calls `delete-blank-lines' when used in a blank line
- Calls `just-one-space' when used in a sequence of whitespaces
- Calls `delete-horizontal-space' when used in one whitespace
"
(interactive)
(skip-chars-forward " \t")
(let ((endcol (current-column))
(iseol (eolp)))
@dacap
dacap / skia-assert.md
Last active March 30, 2016 18:32
Skia assert failed on SkBitmapDevice.cpp Raw

If you get this error:

../../src/core/SkBitmapDevice.cpp:83: fatal error: ""valid_for_bitmap_device(bitmap.info(), nullptr)""
aborted (core dumped)

It might happen because kN32_SkColorType=kBGRA_8888_SkColorType in your code and kN32_SkColorType=kRGBA_8888_SkColorType on Skia side (in valid_for_bitmap_device()).

On Linux, you need to define -DSK_SAMPLES_FOR_X when you compile your own program, this will makekN32_SkColorType=kRGBA_8888_SkColorType.

@dacap
dacap / blog1.md
Last active March 31, 2016 05:00
var fs = require('fs');
var jay = JSON.parse(fs.readFileSync('jay.json', 'utf8'));
var robin = JSON.parse(fs.readFileSync('robin.json', 'utf8'));
var smile = JSON.parse(fs.readFileSync('smile.json', 'utf8'));
var data = { "jay": { "tags": jay.meta.frameTags,
"layers": jay.meta.layers },
"robin": { "tags": robin.meta.frameTags,
"layers": robin.meta.layers },
"smile": { "tags": smile.meta.frameTags,