Skip to content

Instantly share code, notes, and snippets.

View cmb69's full-sized avatar
🏠
Working from home

Christoph M. Becker cmb69

🏠
Working from home
View GitHub Profile
@cmb69
cmb69 / dashed_line.c
Created April 16, 2018 12:13
gdImageSetStyle() and gdImageLine() instead of gdImageDashedLine()
#include <string.h>
#include <gd.h>
/* does not try to create a symmetric pattern */
void dashed_line(gdImagePtr im, int x1, int y1, int x2, int y2, int color)
{
int wid = im->thick; /* this may have to be adjusted */
int *oldStyle, oldStyleLength = im->styleLength, oldStylePos = im->stylePos;
int *newStyle, newStyleLength = wid * gdDashSize * 2;
@cmb69
cmb69 / XH-1.7.0.diff
Last active January 17, 2018 17:27
Startseite – kein DC
cmsimple/classes/Search.php | 6 +++++-
cmsimple/functions.php | 6 ++++--
cmsimple/tplfuncs.php | 13 +++++++++++--
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/cmsimple/classes/Search.php b/cmsimple/classes/Search.php
index 1b5b458..6785cf4 100644
--- a/cmsimple/classes/Search.php
+++ b/cmsimple/classes/Search.php
@@ -214,7 +214,11 @@ class Search
@cmb69
cmb69 / .diff
Created October 12, 2017 16:22
enchant-2
ext/enchant/enchant.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index 77f6840161..b00697a858 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -737,7 +737,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
for (i = 0; i < n_sugg; i++) {
add_next_index_string(sugg, suggs[i]);
@cmb69
cmb69 / hack.diff
Created October 9, 2017 12:50
Always use default lang in back-end
cmsimple/cms.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/cmsimple/cms.php b/cmsimple/cms.php
index fbfe9437..f71e341c 100644
--- a/cmsimple/cms.php
+++ b/cmsimple/cms.php
@@ -338,6 +338,7 @@ if (preg_match('/\/([A-z]{2})\/index.php$/', sv('SCRIPT_NAME'), $temp)
$pth['folder']['content'] = $pth['folder']['base'] . $cf['folders']['content'];
}
@cmb69
cmb69 / xhshop1.nfo
Last active September 17, 2017 10:45
xhshop1.nfo
XH-Shop,1.0,1.0,,,https://github.com/cmsimple-xh/xhshop/releases/tag/1.0,https://gist.githubusercontent.com/cmb69/d6f681e90d62ad17b37a1b71631dc85f/raw/xhshop1.nfo
{
// General options
theme : "advanced",
element_format : "%ELEMENT_FORMAT%",
language : "%LANGUAGE%",
plugins : "calleditor,advimage,advlink,autosave,contextmenu,emotions,fullscreen,insertdatetime,lists,media,paste,save,searchreplace,table,wordcount",
/*
style_formats : [
{title : "Normal", block : "p", classes : true , remove : "all", exact : false},
<?xml version="1.0"?>
<x:books xmlns:x="urn:books">
<book id="1">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<price>44.95</price>
<pub_date>2000-10-01</pub_date>
<review>An amazing story of nothing.</review>
</book>
C:\Users\cmb\php\bugs\73048>php 73048.php
Bearbeitete Datei: parent
1 Dateien erfolgreich verarbeitet, bei 0 Dateien ist ein Verarbeitungsfehler aufgetreten.
Bearbeitete Datei: parent\child
1 Dateien erfolgreich verarbeitet, bei 0 Dateien ist ein Verarbeitungsfehler aufgetreten.
Bearbeitete Datei: parent
1 Dateien erfolgreich verarbeitet, bei 0 Dateien ist ein Verarbeitungsfehler aufgetreten.
Datenträger in Laufwerk C: ist System
Volumeseriennummer: 04CF-334A
<?php
$name = "/tmp/hello.txt.gz";
$file = "compress.zlib://" . $name;
$stream = fopen($file, 'w');
var_dump(flock($stream, LOCK_EX));
fputs($stream, 'hello');
fclose($stream);
<?php
class VariableStream {
var $position;
var $varname;
function stream_open($path, $mode, $options, &$opened_path)
{
$url = parse_url($path);
$this->varname = $url["host"];