Skip to content

Instantly share code, notes, and snippets.

@pupi1985
pupi1985 / qa-wysiwyg-upload.php
Created September 6, 2021 15:47
Improved image upload
<?php
/*
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
File: qa-plugin/wysiwyg-editor/qa-wysiwyg-upload.php
Description: Page module class for WYSIWYG editor (CKEditor) file upload receiver
This program is free software; you can redistribute it and/or
@pupi1985
pupi1985 / qa-badge-page.php
Created January 14, 2017 16:35
Badge's page fix for SnowFlat
function process_request($request)
{
$qa_content=qa_content_prepare();
$qa_content['title']=qa_lang('badges/badge_list_title');
$badges = qa_get_badge_list();
$totalawarded = 0;
<?php
/*
Snow Theme for Question2Answer Package
Copyright (C) 2014 Q2A Market <http://www.q2amarket.com>
File: qa-theme.php
Version: Snow 1.4
Description: Q2A theme class
This program is free software: you can redistribute it and/or modify
<?php
public function initialize()
{
parent::initialize();
$this->displayUserTitleInProfileSectionTitle();
}
private function displayUserTitleInProfileSectionTitle()
{
if ($this->template !== 'user') {
return;
@pupi1985
pupi1985 / refactoring.js
Last active November 18, 2016 17:21
refactoring.js
(() => {
var refactoring = () => {
var node = document.createTextNode("Refactored!");
var body = document.getElementsByTagName("BODY")[0];
if (body.hasChildNodes()) {
body.insertBefore(node, body.firstChild);
} else {
body.appendChild(node);
}
};
@pupi1985
pupi1985 / youtube-refactoring.js
Last active August 5, 2017 19:56
youtube-refactoring.js
document.addEventListener("readystatechange", function (event) {
// Unable to use jQuery here
if (document.readyState == "complete") {
var page = document.getElementById("page");
if (!page) {
return;
}
var performChanges = () => {
var videoTitleSpan = document.getElementById("eow-title");
@pupi1985
pupi1985 / ClassDiagram.gliffy
Created July 13, 2015 04:36
Objectified module management Gliffy class diagram
{"contentType":"application/gliffy+json","version":"1.3","stage":{"background":"#FFFFFF","width":2224,"height":541,"nodeIndex":159,"autoFit":true,"exportBorder":false,"gridOn":true,"snapToGrid":true,"drawingGuidesOn":true,"pageBreaksOn":false,"printGridOn":false,"printPaper":null,"printShrinkToFit":false,"printPortrait":false,"maxWidth":5000,"maxHeight":5000,"themeData":{"uid":"com.gliffy.theme.daily_glyph","name":"The Daily Glyph","shape":{"primary":{"strokeWidth":2,"strokeColor":"#333333","fillColor":"#EEEEEE","gradient":false,"dropShadow":false,"opacity":1,"text":{"color":"#000000"}},"secondary":{"strokeWidth":2,"strokeColor":"#666666","fillColor":"#FFFFFF","gradient":false,"dropShadow":false,"opacity":1,"text":{"color":"#000000"}},"tertiary":{"strokeWidth":2,"strokeColor":"#333333","fillColor":"#CCCCCC","gradient":false,"dropShadow":false,"opacity":1,"text":{"color":"#000000"}},"highlight":{"strokeWidth":2,"strokeColor":"#333333","fillColor":"#333333","gradient":false,"dropShadow":false,"opacity":1,"text"
@pupi1985
pupi1985 / gist:8c7870e90567c3b308be
Created April 16, 2015 03:03
Brute force tests
$permits = array(
QA_PERMIT_ALL => 'QA_PERMIT_ALL',
QA_PERMIT_USERS => 'QA_PERMIT_USERS',
QA_PERMIT_CONFIRMED => 'QA_PERMIT_CONFIRMED',
QA_PERMIT_POINTS => 'QA_PERMIT_POINTS',
QA_PERMIT_POINTS_CONFIRMED => 'QA_PERMIT_POINTS_CONFIRMED',
QA_PERMIT_APPROVED => 'QA_PERMIT_APPROVED',
QA_PERMIT_APPROVED_POINTS => 'QA_PERMIT_APPROVED_POINTS',
QA_PERMIT_EXPERTS => 'QA_PERMIT_EXPERTS',
QA_PERMIT_EDITORS => 'QA_PERMIT_EDITORS',
@pupi1985
pupi1985 / qa-theme.php
Created November 11, 2014 17:47
Gmail SMTP email test using fsockopen
function doctype() {
if (qa_get_logged_in_handle() === 'admin') {
echo "Starting tests...<br>\n";
if(!fsockopen("www.google.com", 80, &$errno, &$errstr, 15))
echo "www.google.com 80 - $errstr ($errno)<br>\n";
else
echo "www.google.com 80 - ok<br>\n";
if(!fsockopen("smtp.gmail.com", 465, &$errno, &$errstr, 15))
echo "smtp.gmail.com 465 - $errstr ($errno)<br>\n";
<?php
/*
Plugin Name: On-Site-Notifications
Plugin URI: http://www.q2apro.com/plugins/on-site-notifications
Plugin Description: Facebook-like / Stackoverflow-like notifications on your question2answer forum that can replace all email-notifications.
Plugin Version: 1.0
Plugin Date: 2014-03-29
Plugin Author: q2apro.com
Plugin Author URI: http://www.q2apro.com/
Plugin License: GPLv3