Skip to content

Instantly share code, notes, and snippets.

View tarnfeld's full-sized avatar

Tom Arnfeld tarnfeld

View GitHub Profile
<?php
include 'config.php';
// This should go in your config.php ^^
define('BASEPATH', dirname(__FILE__));
// Also, convention is capitals for constants
define('NAME', "Tom");
function tint($tinty){
<?php
/* $board = "
+---+---+---+---+---+---+---+
| | | | | | | |
+---+---+---+---+---+---+---+
| | | R | | | | |
+---+---+---+---+---+---+---+
| R | | R | W | | | R |
+---+---+---+---+---+---+---+
<?php
function stylesheet($title = 'Home Page')
{
$filename = trim(strtolower($title)); // EG: "Home Page" => "homepage"
echo '<link rel="stylesheet" href="../css/' . $filename . '.css" type="text/css" media="all" />';
}
@tarnfeld
tarnfeld / blog.php
Created February 21, 2011 07:29 — forked from dhrrgn/blog.php
<?php
class Controller_Blog extends Controller {
/**
* This is a simple example, the class does not exist. There are much more
* things you would be able to do, this is just an example.
*
* Yes, I know this is all (kind of) currently possible, but this encapsulates
* the response and allows for nice things like advanced response caching.
import simplejson, urllib
from sys import argv
class PHPFPM:
def __init__(self, agent_config, checksLogger, rawConfig):
self.agent_config = agent_config
self.checks_logger = checksLogger
self.raw_config = rawConfig
self.status_url = "http://127.0.0.1/status"
<?php
class Menu
{
public static function get()
{
$results = DB::query('SELECT * FROM `menu_items` ORDER BY parent_id IS NULL DESC, parent_id ASC, position ASC')->execute()->as_array();
//
// LESS - Leaner CSS v1.1.4
// http://lesscss.org
//
// Copyright (c) 2009-2011, Alexis Sellier
// Licensed under the Apache 2.0 License.
//
(function (window, undefined) {
//
// Stub out `require` in the browser
@tarnfeld
tarnfeld / less-1.1.4.js
Created September 11, 2011 18:02
Less JS 1.1.4 with fix for @{var} starting url()'s
//
// LESS - Leaner CSS v1.1.4
// http://lesscss.org
//
// Copyright (c) 2009-2011, Alexis Sellier
// Licensed under the Apache 2.0 License.
//
(function (window, undefined) {
//
// Stub out `require` in the browser
@tarnfeld
tarnfeld / index.html
Created October 2, 2011 22:53
Scroll tracking
<html>
<head>
<title>thing</title>
<style type="text/css">
.section {
height: 600px;
background: red;
}
</style>
$('#full').scroll(function() {
var el = false;
console.log('-----');
$('.set').each(function(i, e) {
console.log($(e).offset().top - 32);
if (!el && ($(e).offset().top - 32) == 0) {
el = $(this);