Skip to content

Instantly share code, notes, and snippets.

View enko's full-sized avatar
🐉
🧙

Tim enko

🐉
🧙
View GitHub Profile
#include <fcntl.h>
#include <getopt.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/kd.h>
<?php
class Actions {
public function doStuff() {
}
}
class Menu {
var items = array(); // contains MenuItems or Menu (SubMenus!)
}
@enko
enko / .emacs
Created February 28, 2012 19:18
emacs
(autoload 'wl "wl" "Wanderlust" t)
(autoload 'wl-other-frame "wl" "Wanderlust on new frame." t)
(autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t)
(autoload 'wl-user-agent-compose "wl-draft" nil t)
(if (boundp 'mail-user-agent)
(setq mail-user-agent 'wl-user-agent))
(if (fboundp 'define-mail-user-agent)
(define-mail-user-agent
'wl-user-agent
@enko
enko / teaser.py
Created February 20, 2012 15:25
teaser behavior
"""Behavior to automaticly create a teaser
Checks the description, if nothing is entered, we will generate something from the body.
"""
from rwproperty import getproperty, setproperty
from zope.interface import implements, alsoProvides
from zope.component import adapts
add_hook("buffer_loaded_hook",
function (buffer) {
if (! buffer instanceof content_buffer)
return;
if (/\/\/thread\.gmane\.org/.test(buffer.display_uri_string)) {
for (var frame in frame_iterator(buffer.top_frame)) {
frame = buffer.top_frame.frames[0];
if (frame.name != 'threads')
continue;
@enko
enko / hipchat_bot.js
Created September 15, 2011 11:05 — forked from powdahound/hipchat_bot.js
Basic XMPP bot example for HipChat using node.js
// Basic XMPP bot example for HipChat using node.js
// To use:
// 1. Set config variables
// 2. Run `node hipchat_bot.js`
// 3. Send a message like "!weather 94085" in the room with the bot
var request = require('request'); // github.com/mikeal/request
var sys = require('sys');
var util = require('util');
@enko
enko / getmessage.py
Created June 1, 2011 13:05
git prepare commit message hook
import subprocess
import sys
p = subprocess.check_output(['git','diff','--cached','--name-only'])
if (len(p) > 0):
p = p.split('\n')
if (len(p) > 1):
sys.stdout.write('Dateien:\n')
else:
{ So richtig ersichtlich ist es nicht für was das zu gebrauchen aber here we go… }
{ Diese Klasse speichert das OnChange Event eines TField-Objektes und
ersetzt das OnChange-Event mit einer eigenen Funktion. Die eigene
Funktion ruft das original OnChange-Event auf und das eigene
OnAlert-Event auf, so es denn vorhanden ist. }
unit uCCRefreshTitleFieldOnChange;
@enko
enko / urls.py
Created January 13, 2011 22:00 — forked from 0x46616c6b/urls.py
def manage(request):
if (request.action == 'new_entry'):
result = new_entry(request)
render(request.format,result)
if (request.action == 'new_pin'):
result = new_pin(request)
render(request.format,result)
def render(format,obj):
if (format == 'json'):
@enko
enko / urls.py
Created January 13, 2011 21:37 — forked from 0x46616c6b/gist:778662
def new_entry(request):
format = "json"
if ('format' in request.POST):
format = request.POST['format']
if ('submit' in request.POST):
# gives us a json: { "text" : "Dies ist eine Meldung", "isPublic" : 1 }
# entry_text =
# entry_isPublic =
# entry_published = datetime.now()
# -> save