Skip to content

Instantly share code, notes, and snippets.

Avatar

Gabriel Zanetti pupi1985

View GitHub Profile
@pupi1985
pupi1985 / qa-badge-page.php
Created Jan 14, 2017
Badge's page fix for SnowFlat
View qa-badge-page.php
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;
View qa-theme.php
<?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
View qa-theme.php
<?php
public function initialize()
{
parent::initialize();
$this->displayUserTitleInProfileSectionTitle();
}
private function displayUserTitleInProfileSectionTitle()
{
if ($this->template !== 'user') {
return;
@pupi1985
pupi1985 / refactoring.js
Last active Nov 18, 2016
refactoring.js
View 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 Aug 5, 2017
youtube-refactoring.js
View 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 Jul 13, 2015
Objectified module management Gliffy class diagram
View ClassDiagram.gliffy
{"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"
View gist:8c7870e90567c3b308be
$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 Nov 11, 2014
Gmail SMTP email test using fsockopen
View qa-theme.php
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";
View q2apro-onsitenotifications-layer.php
<?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
View qa-theme.php
function doctype(){
if ($this->template === 'question' && isset($this->content['q_view'])) {
$this->addCategoryPrefixToTitleInList($this->content['q_view'], isset($this->content['title']));
}
qa_html_theme_base::doctype();
}
function addCategoryPrefixToTitleInList(&$q_item, $shouldChangeTitle) {
if (isset($q_item['raw']['categoryid'], $q_item['raw']['categoryname'], $q_item['title'])) {
$categoryId = $q_item['raw']['categoryid'];