Skip to content

Instantly share code, notes, and snippets.

View dacap's full-sized avatar
🎨
Programming

David Capello dacap

🎨
Programming
View GitHub Profile
#include <iostream>
#include "miniapp/miniapp.h"
using namespace miniapp;
int main()
try {
Window w;
w.on_paint = [](Canvas& canvas) {
canvas.fill_rect(rgb(255, 255, 255), Rect(0, 0, 255, 255));
@dacap
dacap / create-vms.ps1
Last active August 29, 2015 14:15
Azure SSH Broken pipe at East US 2
azure network reserved-ip create vmname1-reserved-ip "West Europe"
azure vm create `
--location "West Europe" `
--userName username `
--ssh 22 `
--ssh-cert mypublickey.pem `
--no-ssh-password `
--reserved-ip vmname1-reserved-ip `
--vm-size Small `
--vm-name vmname1 `
tab-text-color: #000000;
tab-background {
slice: sheet.png 0 0 16 16;
}
tab-close-icon {
slice: sheet.png 16 0 16 16;
}
// Don't modify, generated file from /aseprite/data/pref.xml
#ifndef GENERATED_PREF_TYPES_H_INCLUDED
#define GENERATED_PREF_TYPES_H_INCLUDED
#pragma once
#include <string>
namespace app {
namespace gen {
@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">
@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"
@dacap
dacap / MouseWheelVolume.ahk
Created August 2, 2011 00:39
Change volume with mouse wheel over task bar
#If MouseIsOver("ahk_class Shell_TrayWnd")
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
@dacap
dacap / gist:2151790
Created March 21, 2012 19:34
Pseudo-code to show closures
// The following function, "Calculate_average", will be the only
// public function in your library API
FUNCTION Calculate_average ( N1, N2, ..., NN )
LOCAL VARIABLE sum = 0
LOCAL VARIABLE count = 0
// Define a function named "sum_and_count" that isn't public API of your library,
// this function is visible and usable only inside "Calculate_average"
LOCAL FUNCTION sum_and_count(x)
sum = sum + x // The key of closures: here we can modify variables that are not in the scope of sum_and_count()