Skip to content

Instantly share code, notes, and snippets.

Avatar
🎨
Working on @aseprite / @igarastudio

David Capello dacap

🎨
Working on @aseprite / @igarastudio
View GitHub Profile
@dacap
dacap / MouseWheelVolume.ahk
Created Aug 2, 2011
Change volume with mouse wheel over task bar
View MouseWheelVolume.ahk
#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 / AlwaysOnTop.ahk
Created Dec 13, 2011
AutoHotKey script for "Google Chrome - Always on top"
View AlwaysOnTop.ahk
#o::
WinSet, Alwaysontop, , A
WinGet, ExStyle, ExStyle, A
if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST
{
WinSet, Transparent, 204, A
}
else
{
@dacap
dacap / gist:2151790
Created Mar 21, 2012
Pseudo-code to show closures
View gist:2151790
// 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()
@dacap
dacap / gist:2155047
Created Mar 22, 2012
More closure magic in pseudo-code
View gist:2155047
// Holly crap! Now we can give the "sum_and_count" function as a parameter.
FUNCTION Calculate_average ( sum_and_count, N1, N2, ..., NN )
LOCAL VARIABLE sum = 0
LOCAL VARIABLE count = 0
FOR_EACH N = N1, N2, ..., NN
CALL_THE_FOLLOWING_FUNCTION sum_and_count ( N )
RETURN num / count
END FUNCTION
@dacap
dacap / emacs-c++key-stats.txt
Created May 23, 2012
dacap's key stats 2012-05-23
View emacs-c++key-stats.txt
950054 16.84% self-insert-command
756545 13.41% next-line
675163 11.97% previous-line
...
213058 3.78% move-beginning-of-line
201271 3.57% subword-forward
...
101016 1.79% subword-backward
97459 1.73% c-forward-subword
94503 1.68% backward-sexp
@dacap
dacap / test.cpp
Created Jun 12, 2012
Emacs C++ navigation test
View test.cpp
namespace my_namespace {
void func1() {
}
void func2() {
}
class MyClass {
public:
View demo1.cpp
#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 Aug 29, 2015
Azure SSH Broken pipe at East US 2
View create-vms.ps1
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 `
View gist:06b2af2839c31bdab3fb
tab-text-color: #000000;
tab-background {
slice: sheet.png 0 0 16 16;
}
tab-close-icon {
slice: sheet.png 16 0 16 16;
}
View generated_pref_types.h
// 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 {