Skip to content

Instantly share code, notes, and snippets.

View callumacrae's full-sized avatar

Callum Macrae callumacrae

View GitHub Profile
<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
//dartlang:
document.query('#next').on.click.add((e) {
sliderMenu.selectNext(true);
});
//javascript:
var next = document.getElementById('next');
function cb() {
sliderMenu.selectNext(true);
</div>
<div id="page-footer">
<div class="navbar">
<div class="inner"><span class="corners-top"><span></span></span>
<ul class="linklist">
<li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a></li>
<!-- IF not S_IS_BOT -->
@callumacrae
callumacrae / format_string_cli.php
Created November 22, 2011 18:19
A static class to format strings for CLI.
<?php
class FormatStringCLI
{
private static $fg_colors = array(
'black' => '0;30',
'dark_grey' => '1;30',
'blue' => '0;34',
'light_blue' => '1;34',
'green' => '0;32',
// Handle registration info updates
$data = array(
'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)),
'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0),
'email' => strtolower(request_var('user_email', $user_row['user_email'])),
'email_confirm' => strtolower(request_var('email_confirm', '')),
'new_password' => request_var('new_password', '', true),
'password_confirm' => request_var('password_confirm', '', true),
);
@callumacrae
callumacrae / gist:1804907
Created February 11, 2012 23:06
Bogosort
Array.prototype.isSorted = function () {
for (var i = 1; i < this.length; i++) {
if (this[i] < this[i - 1]) {
return false;
}
}
return true;
};
Array.prototype.shuffle = function () {
@callumacrae
callumacrae / gist:1871367
Created February 20, 2012 20:57 — forked from brunoais/gist:1871142
not my solution to deal with IE
<!--[if !IE]>
<script defer type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script defer type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
<![endif]-->
<!--[if IE]>
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
<![endif]-->
<script defer type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js"></script>
<script defer type="text/javascript" src="{T_TEMPLATE_PATH}/ajax.js"></script>
#!/bin/sh
# Compile a list of changed files
FILES=`git diff --name-only HEAD^`
# Attempt to fix whitespace issues
for FILE in `egrep -l '(\s$| {1,3}\t)' $FILES`
do
# Remove trailing whitespace
(sed -i 's/[ ]*$//' $FILE > /dev/null 2>&1 || sed -i '' -E 's/[ ]*$//' $FILE)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
<title>{{ site.name }} &bull; Index Page</title>
<link href="{{ css_url }}">
</head>
<body>
<header>

For all demonstrations that involve him writing code, it is probably worth asking him to use JSFiddle: http://jsfiddle.net/

A client wants some text scrolling horizontally across the page. Write something to do this for him.

  • Bad answer: Code uses the tag. It is a bad answer as the marquee tag isn't standard, and technically doesn't exist.
  • Good answer: He simulates the behaviour of the marquee tag in JavaScript. Minus points if he uses inline style or javascript.
  • Best answer: He tries to talk you out of it.
  • Explain to me, a backend developer, what the most recent relevant article you read was about.