Skip to content

Instantly share code, notes, and snippets.

View chrisboulton's full-sized avatar
🦊

Chris Boulton chrisboulton

🦊
View GitHub Profile
<div class="Block Moveable Panel" id="MyOwnCode">
<h2>Heading</h2>
<div class="BlockContent">
<p>Hello, world!</p>
</div>
</div>
<?php
// includes/classes/class.category.php. Add before:
// $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($this->BuildTitle());
$bodyClasses = '';
$parents = explode(',', $this->Data['catparentlist']);
foreach($parents as $parent) {
if(!trim($parent)) {
continue;
Title tag:
<title>%%Page.WindowTitle%%</title>
Meta tags:
<meta name="description" content="%%Page.MetaDescription%%" />
<meta name="keywords" content="%%Page.MetaKeywords%%" />
<?php
/**
* Several improvements to the visitor HTML tracking code in Kayako SupportSuite
* (replaces modules/livechat/visitor_htmlcode.php)
*
* - Automatic updates of live chat status images/text when the operator status changes in Kayako - no longer needs a page refresh.
* - Clean up the indicator Javascript, keep all instances under a clean single class rather than a heap of variableSuffix based functions.
* - Have Firefox browser version detected correctly instead of Gecko/Mozilla.
* - Have several other browsers also correctly identified.
* - Replace <img> tag status updating/footprint updating with an AJAX request (or <script> tags across domains)
<?php
$this->staticClass = 'Some_Static_Class';
$staticClass = $this->staticClass;
echo $staticClass::$somevar;
Consider the following blocks of code from a controller and a view
whereby an existing comment is loaded from the database through a
model, and then a form is shown to edit the comment.
The form should handle th case where if one or more required
fields were left empty, the edit comment form should be shown again
with the values from the POST populating it instead of those from
the model.
The first example shows a typical approach of handling this
Dear Website Optimizer user,
We are writing to inform you of a potential security issue with Website Optimizer. By exploiting a vulnerability in the Website Optimizer Control Script, an attacker might be able to execute malicious code on your site using a Cross-Site Scripting (XSS) attack. This attack can only take place if a website or browser has already been compromised by a separate attack. While the immediate probability of this attack is low, we urge you to take action to protect your site.
We have fixed the bug, and all new experiments are not susceptible. However, any experiments you are currently running need to be updated to fix the bug on your site. Additionally, if you have any Website Optimizer scripts from paused or stopped experiments created before December 3, 2010, you will need to remove or update that code as well.
There are two ways to update your code. You can either stop current experiments, remove the old scripts, and create a new experiment, or you can update the code on your site d
exec = require('child_process').exec
{Plugin} = require '../plugin'
module.exports = class Plugin_Disk_Space extends Plugin
collect: ->
df = exec 'df -P -l', (err, stdout, stderr) =>
[head, mounts...] = stdout.split "\n"
for line in mounts
continue if not line
[fs, total, used, avail, junk, mount] = line.match(/[^\s]+/g)
var Plugin, Plugin_Disk_Space, exec;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __slice = Array.prototype.slice, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
exec = require('child_process').exec;
# All posts tagged with tag 1 AND tag 2
# The two on the right side of the condition should match the number of tags you need to match on.
# If it was three tags, it would be = 3.
SELECT *
FROM `posts`
WHERE (
SELECT COUNT(1)
FROM `postTags`