Skip to content

Instantly share code, notes, and snippets.

View gergelypolonkai's full-sized avatar

Gergely Polonkai gergelypolonkai

View GitHub Profile
@gergelypolonkai
gergelypolonkai / add-gtk-doc-block.el
Created January 14, 2016 16:15
Add Gtk-Doc block before the current function
(defun get-point(symbol &optional arg)
"Get point, optionally running a command beforehand"
(funcall symbol arg)
(point))
(defun current-line-number()
(save-restriction
(widen)
(save-excursion
@gergelypolonkai
gergelypolonkai / implement-gobject-vfunc.el
Last active January 13, 2016 14:26
GObject virtual table to implementation list
(require 'thingatpt)
(defun get-point(symbol &optional arg)
"Get point, optionally running a command beforehand"
(funcall symbol arg)
(point))
(defun copy-symbol-at-point()
"Copy the symbol under point"
@gergelypolonkai
gergelypolonkai / README.md
Created November 30, 2015 14:15
gcov-blame

gcov-blame

A bash/zsh function to visualise coverage data for projects built with GNU libtool.

Usage

gcov-blame src/source-file.c

This will generate the appropriate .gcov file and display it in the terminal. The coverage data should be generated by whatever means first (e.g. make check).

@gergelypolonkai
gergelypolonkai / README.md
Last active November 10, 2015 08:18
Expandable Widget for Dashing.io

An expandable widget base type for Dashing.io

Usage

Add data-expsizex and data-expsizey to the widget <li> tag:

<li data-row="1" data-col="1" data-sizex="1" data-sizey="1" data-expsizex="2" data-expsizey="2">
@gergelypolonkai
gergelypolonkai / helper.py
Last active August 29, 2015 14:22
@ParamConverter à la Django
# -*- coding: utf-8 -*-
import re
from django.shortcuts import get_object_or_404
from django.db import models
def convert_params(*params_to_convert, **options):
"""
Convert parameters to objects. Each parameter to this decorator
@gergelypolonkai
gergelypolonkai / border-radius.sass
Created April 27, 2015 20:19
Cross-browser border radius mixin in SASS with variable parameters
=border-width($t, $r: $t, $b: $t, $l: $r)
border-top-width: $t
border-right-width: $r
border-bottom-width: $b
border-left-width: $l
=border-top-right-radius($value)
border-top-right-radius: $value
-moz-border-top-right-radius: $value
-webkit-border-top-right-radius: $value
@gergelypolonkai
gergelypolonkai / Makefile
Created April 27, 2015 08:54
Registering a GLib EnumType using glib-mkenums and GNU Autotools
gswe_enum_headers = headers-that-contain-enums.h
gswe-enumtypes.h: $(gswe_enum_headers) gswe-enumtypes.h.template
$(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
gswe-enumtypes.h.tmp && mv gswe-enumtypes.h.tmp gswe-enumtypes.h
gswe-enumtypes.c: $(gswe_enum_headers) gswe-enumtypes.h gswe-enumtypes.c.template
$(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
gswe-enumtypes.c.tmp && mv gswe-enumtypes.c.tmp gswe-enumtypes.c
@gergelypolonkai
gergelypolonkai / client-state.c
Created April 27, 2015 08:47
Registering a GLib ENumType
#include "wmudclientstate.h"
GType
wmud_client_state_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter(&g_define_type_id__volatile)) {
static const GEnumValue values[] = {
{ WMUD_CLIENT_STATE_FRESH, "WMUD_CLIENT_STATE_FRESH", "fresh" },
@gergelypolonkai
gergelypolonkai / WhatEver.php
Created April 27, 2015 08:40
Role and class based ACLs with Symfony 2
<?php
$this->get('security.context')->isGranted('ROLE_ADMIN');
@gergelypolonkai
gergelypolonkai / redirect-non-existing.conf
Created April 27, 2015 08:28
Redirect only non-existing files with Apache
RewriteEngine on
RewriteRule ^/$ http://172.16.72.131:8080/ [QSA,L,P]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*) http://172.16.72.131:8080/$1 [QSA,L,P]
Order allow,deny
Allow from all