Skip to content

Instantly share code, notes, and snippets.

View codebrainz's full-sized avatar

Matthew Brush codebrainz

View GitHub Profile
@codebrainz
codebrainz / gist:1991520
Created March 7, 2012 06:45
Simple Mac application
/*
* A very basic Cocoa application.
*
* Save as "main.m" and compile in Terminal.app with:
* clang -o test main.m -framework AppKit -fobj-c-arc
*/
#import <AppKit/AppKit.h>
@interface TestView : NSView <NSWindowDelegate>
- (void)drawRect:(NSRect)rect;
@codebrainz
codebrainz / gist:2016617
Created March 11, 2012 14:29
Color scheme and filedef version checking
diff --git a/data/colorschemes/alt.conf b/data/colorschemes/alt.conf
index 6d0e3dd..a4e8ae8 100644
--- a/data/colorschemes/alt.conf
+++ b/data/colorschemes/alt.conf
@@ -1,9 +1,10 @@
[theme_info]
name=Alternate
description=Alternate Geany color scheme with styles like the Geany <= 0.19 Python/script defaults with gray comments.
-version=0.01
-author=
@codebrainz
codebrainz / gist:2038371
Created March 14, 2012 18:15
Color scheme dialog view border and scrollbars
diff --git a/src/highlighting.c b/src/highlighting.c
index b87c18b..bf4ef1e 100644
--- a/src/highlighting.c
+++ b/src/highlighting.c
@@ -1339,6 +1339,9 @@ static void show_color_scheme_dialog(void)
GEANY_DEFAULT_DIALOG_HEIGHT * 7/4, GEANY_DEFAULT_DIALOG_HEIGHT);
swin = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin), GTK_SHADOW_ETCHED_IN);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
@codebrainz
codebrainz / gist:2153795
Created March 21, 2012 22:29
CTAGS - Add D, GLSL, Ferite and Vala support (untested)
Index: parsers.h
===================================================================
--- parsers.h (revision 781)
+++ parsers.h (working copy)
@@ -26,11 +26,14 @@
CppParser, \
CsharpParser, \
CobolParser, \
+ DParser, \
DosBatchParser, \
@codebrainz
codebrainz / gist:2223810
Created March 28, 2012 05:11
Allow writing Geany plugins in C++
diff --git a/src/build.h b/src/build.h
index 4e92290..543c329 100644
--- a/src/build.h
+++ b/src/build.h
@@ -24,6 +24,8 @@
#ifndef GEANY_BUILD_H
#define GEANY_BUILD_H 1
+G_BEGIN_DECLS
+
@codebrainz
codebrainz / gist:2341387
Created April 9, 2012 04:15
Convert newlines to \n and strip extra trailing whitespace
#include <stdio.h>
#include <string.h>
#define MAXLINE 16484
int main(void)
{
int c;
size_t len;
char line[MAXLINE] = { 0 };
@codebrainz
codebrainz / gist:2353163
Last active November 11, 2015 02:40
Add some more open source license to Geany
diff --git a/data/geany.glade b/data/geany.glade
index 3c04578..184cce0 100644
--- a/data/geany.glade
+++ b/data/geany.glade
@@ -269,6 +269,26 @@
</object>
</child>
<child>
+ <object class="GtkMenuItem" id="insert_apache2_notice1">
+ <property name="use_action_appearance">False</property>
@codebrainz
codebrainz / c99.l
Created June 14, 2012 23:49
C99 Lex/Flex & YACC/Bison Grammars
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E ([Ee][+-]?{D}+)
P ([Pp][+-]?{D}+)
FS (f|F|l|L)
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U))
%{
#include <stdio.h>
@codebrainz
codebrainz / tabsort.c
Last active October 26, 2021 23:55
Automatically Sort Geany's Document Tabs
#include <geanyplugin.h>
GeanyData *geany_data;
GeanyPlugin *geany_plugin;
GeanyFunctions *geany_functions;
PLUGIN_VERSION_CHECK(211);
PLUGIN_SET_INFO("Tab Sort",
"Automatically keeps document tabs sorted",
@codebrainz
codebrainz / main.c
Created October 13, 2012 07:20
ASCII Characters
------------------------------------------------------------------------------
| Dec | Oct | Hex | Binary | Asc | Description |
------------------------------------------------------------------------------
| 0 | 0000 | 00 | 00000000 | NUL | Null char |
| 1 | 0001 | 01 | 00000001 | SOH | Start of Heading |
| 2 | 0002 | 02 | 00000010 | STX | Start of Text |
| 3 | 0003 | 03 | 00000011 | ETX | End of Text |
| 4 | 0004 | 04 | 00000100 | EOT | End of Transmission |
| 5 | 0005 | 05 | 00000101 | ENQ | Enquiry |
| 6 | 0006 | 06 | 00000110 | ACK | Acknowledgment |