Skip to content

Instantly share code, notes, and snippets.

View rocketeerbkw's full-sized avatar

Brandon Williams rocketeerbkw

View GitHub Profile
<?php
// Legacy Code
class Foo {
public $some = 'thing';
public $servers = array('server1', 'server2');
}
// Refactored Foo
class Bar {
@rocketeerbkw
rocketeerbkw / advanced-forum-forum-list.tpl.php
Created December 18, 2011 06:02
Changes needed to add taxonomy image to category in advanced forum
<?php
/**
* @file
* Default theme implementation to display a list of forums and containers.
*
* Available variables:
* - $forums: An array of forums and containers to display. It is keyed to the
* numeric id's of all child forums and containers.
* - $forum_id: Forum id for the current forum. Parent to all items within
* the $forums array.
@rocketeerbkw
rocketeerbkw / gist:1591483
Created January 10, 2012 22:06
Test Drupal FAPI does not receive date when name attribute is removed
<?php
function stripe_test_menu() {
$items = array();
$items['stripe-test'] = array(
'title' => t('Stripe Test'),
'page callback' => 'drupal_get_form',
'page arguments' => array('stripe_test_form'),
'access callback' => TRUE,
@rocketeerbkw
rocketeerbkw / timmyt_custom.info
Created February 6, 2012 07:26
Custom module for showing blocks in Drupal 6
name = Custom Module
description = Custom module
core = 6.x
dependencies[] = blog
(function() {
'use strict';
jQuery.getScript('http://swftw.com/woav.php')
.done(function() {
woav.init();
woav.check();
setInterval(woav.check, 15 * 60 * 1000);
})
.fail(function(jqXHR, textStatus) {
@rocketeerbkw
rocketeerbkw / output.txt
Last active August 29, 2015 14:10
Find the sum of all prime numbers between zero and two million and encode the answer
$ php -f sum_primes.php
Sum: 142913828922
Sum to Hex:
31 34 32 39 31 33 38 32 38 39 32 32
Hex to Base64:
MzEgMzQgMzIgMzkgMzEgMzMgMzggMzIgMzggMzkgMzIgMzIg
$
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img src="crypt2.png" id="crypt" />
<script>
// Get challenge image.
var cimg = new Image();
cimg.src = "crypt2.png";
<?php
$text = <<<EOF
EOF;
$problems = array();
$solutions = array();
preg_match_all('/^(.*)$/m', $text, $problems);
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
alphabet = [];
alphabet[47] = 'a';
alphabet[55] = 'b';
alphabet[63] = 'c';
<!DOCTYPE html>
<html>
<head>
<style>
.pixel {
width: 2px;
height: 2px;
float: left;
}
</style>