Skip to content

Instantly share code, notes, and snippets.

View codebrainz's full-sized avatar

Matthew Brush codebrainz

View GitHub Profile
diff --git a/src/utils.c b/src/utils.c
index cd06641..ff52a13 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -103,6 +103,7 @@ void utils_open_browser(const gchar *uri)
/* taken from anjuta, to determine the EOL mode of the file */
gint utils_get_line_endings(const gchar* buffer, gsize size)
{
+# define MAX_LINES 10
gsize i;
@codebrainz
codebrainz / gist:1288896
Created October 15, 2011 02:08
Guess the line-endings mode of a text buffer
typedef enum
{
LINE_END_MODE_CR,
LINE_END_MODE_LF,
LINE_END_MODE_CRLF
}
LineEndMode;
LineEndMode guess_line_endings(const char* buffer, size_t size)
{
@codebrainz
codebrainz / gist:1263776
Created October 5, 2011 06:15
Cleanup trailing spaces
#!/usr/bin/env python
import sys
filenames = sys.argv[1:]
def backup_file (fn):
open ("%s~" % fn, "w").write (open (fn, "r").read ())
for fn in filenames:
@codebrainz
codebrainz / gist:1223591
Created September 17, 2011 03:21
support embedded languages
diff --git a/src/editor.c b/src/editor.c
index b8419a0..516c919 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -378,6 +378,17 @@ static gboolean is_style_php(gint style)
}
+static gboolean is_style_js(gint style)
+{
@codebrainz
codebrainz / ai-test.c
Created June 20, 2011 23:53
Why no "query-tooltip" signal with AppIndicator?
#include <gtk/gtk.h>
#include <libappindicator/app-indicator.h>
static void on_status_icon_activate(GtkStatusIcon *status_icon, GtkMenu *menu)
{
gtk_menu_popup(menu, NULL, NULL, gtk_status_icon_position_menu, status_icon,
0, gtk_get_current_event_time());
}
@codebrainz
codebrainz / gist:1009404
Created June 5, 2011 20:44
On the fly tarball creation CGI script.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# archive.py
#
# Copyright 2011 Matthew Brush <mbrush@codebrainz.ca>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@codebrainz
codebrainz / gist:1003959
Created June 2, 2011 05:02
Geany - Grab focus after opening each document (Scintilla Widgets).
diff --git a/src/keyfile.c b/src/keyfile.c
index ad6aea5..5577b39 100644
--- a/src/keyfile.c
+++ b/src/keyfile.c
@@ -1031,6 +1031,7 @@ static gboolean open_session_file(gchar **tmp, guint len)
editor_set_line_wrapping(doc->editor, line_wrapping);
doc->editor->line_breaking = line_breaking;
doc->editor->auto_indent = auto_indent;
+ gtk_widget_grab_focus(doc->editor->sci);
ret = TRUE;
@codebrainz
codebrainz / gist:985252
Created May 22, 2011 07:33
Add 'enum' keyword for Java 5.0
diff --git a/data/filetypes.java b/data/filetypes.java
index 57a4843..633daa9 100644
--- a/data/filetypes.java
+++ b/data/filetypes.java
@@ -26,7 +26,7 @@ globalclass=type
[keywords]
primary=abstract assert break case catch class const continue default do else extends final finally for future generic goto if implements import inner instanceof interface native new outer package private protected public rest return static super switch synchronized this throw throws transient try var volatile while true false null
-secondary=boolean byte char double float int long short void
+secondary=boolean byte char double float int long short void enum
changeset: 2603:b97cf584311b
tag: tip
parent: 2592:247816f97bea
user: Matthew Brush <matthewbrush@gmail.com>
date: Wed May 11 21:04:14 2011 -0700
summary: Add include to makefiles, remove trailing spaces after backslash.
diff -r 247816f97bea -r b97cf584311b src/Makefile.am
--- a/src/Makefile.am Wed May 11 22:48:19 2011 -0400
+++ b/src/Makefile.am Wed May 11 21:04:14 2011 -0700
--- src/Makefile.am.old 2011-05-11 20:16:53.996766001 -0700
+++ src/Makefile.am 2011-05-11 20:32:45.116766001 -0700
@@ -603,6 +603,8 @@
noinst_LIBRARIES += libtomcrypt.a
+main_CPPFLAGS = -I$(top_srcdir)/extern/jsoncpp/include
+
main_SOURCES = $(PNG) \
$(Screens) \