Skip to content

Instantly share code, notes, and snippets.

@leylaso
leylaso / Formula.java
Created January 23, 2014 14:20
Demonstrate a way to parse a mathematical
import java.util.LinkedList;
/**
* This class allows the calculation of a mathematical formula
*/
public class Formula {
private String formula;
private double result;
/**
@leylaso
leylaso / gist:7622365
Created November 24, 2013 01:47
Ongoing work on a java imp of a B+tree
import java.util.*;
/**
* B+ Tree generic type
*
* @author Sofian Benaissa
*/
public class BplusTree<K extends Comparable<K>,V>
{
@leylaso
leylaso / pad.js
Created March 28, 2012 04:18
custom pad.js file for etherpad-lite allows setting author names as line numbers
/**
* @file
* This file is an example of ways to modify etherpad-lite behaviour from the
* static/custom/pad.js file generated by etherpad-lite on first run.
*/
var edBod = [];
var lastLine = 0;
/**
@leylaso
leylaso / koumbit-ledger-smb.user.js
Created November 4, 2011 20:36
Billing workflow for LedgerSMB
// ==UserScript==
// @name Koumbit LedgerSMB billing workflow
// @match https://ledger.koumbit.net/*
// ==/UserScript==
/**
* @file
* Email templates and interface tweaks for ledger SMB emails
*
* Licensed under GPLv2.
@leylaso
leylaso / .bashrc
Created October 28, 2011 14:05
dev environment aegir user .bashrc
# WARNING: This should be used in private, dev environments ONLY
# Not for production environments
#
# This files adjusts the aegir users bash environment to make certain
# common development tasks a little easier
# Make sure aegir files are group=-writable
umask 0002
# Aliases to make development a little easier
@leylaso
leylaso / file.inc_ereg_to_preg.patch
Created October 26, 2011 17:50
ereg to preg patch for Drupal 6.22 includes/files.inc
From 45eaed831098fe253b0089517b3bdc8ac51f8d66 Mon Sep 17 00:00:00 2001
From: Sofian Benaissa <sofian@koumbit.org>
Date: Wed, 26 Oct 2011 13:48:54 -0400
Subject: [PATCH] ereg to preg in file.inc
---
includes/file.inc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/includes/file.inc b/includes/file.inc
@leylaso
leylaso / gist:1025146
Created June 14, 2011 15:33
redmine stealth button blinker
/**
* Paste this code into your greasemonkey or browser console to enable
* deep defense against redmine's stealth mode
*/
stealthButton = document.getElementById('stealth_toggle');
blonk = 0
if (stealthButton.innerHTML == 'Disable stealth mode')
{
setInterval ('blink(stealthButton)', 500);
@leylaso
leylaso / template.php
Created May 12, 2011 15:20
Drupal 6 theme functions to insert a jcarousel that uses lightbox into any node with the appropriate image field, for use in a template.php file
<?php
/**
* Node preprocess function
*/
function mytheme_preprocess_node(&$vars, $hook) {
if ($vars['node']->field_image && !empty($vars['node']->field_image)) {
$vars['image_carousel'] = _mytheme_generate_carousel($vars['node']->field_image);
}
}
@leylaso
leylaso / showCkutStream.js
Created May 12, 2011 13:06
Javascript function to show an element only during a specific time, depends on jQuery
// Initialize some variables - we will use GMT times
var checkDate = new Date();
var offTheHourStarts = 21;
var offTheHourEnds = 22;
// Adjust for Daylight savings
if ((checkDate.getMonth() < 2 && checkDate.getMonth() > 10) || (checkDate.getMonth() == 2 && checkDate.getDate()-checkDate.getDay() > 7 ) || (checkDate.getMonth() == 10 && checkDate.getDate()-checkDate.getDay() > 1)) {
offTheHourStarts--;
offTheHourEnds--;
}