Skip to content

Instantly share code, notes, and snippets.

View mwalters's full-sized avatar
📟
.... .- -.-. -.- / - .... . / .--. .-.. .- -. . -

Matt Walters mwalters

📟
.... .- -.-. -.- / - .... . / .--. .-.. .- -. . -
View GitHub Profile
@mwalters
mwalters / routing.php
Created August 27, 2013 16:00
Snippet: Poor Mans PHP Routing
<?php
// CONFIG: Path to Controllers, including trailing slash
$contollerPath = './Controllers/';
// If there is a query string, then get its position so it can be separated from the Controller/Method requested
if (strpos($_SERVER['REQUEST_URI'], '?')) {
$queryOffset = strpos($_SERVER['REQUEST_URI'], '?') - ($_SERVER['REQUEST_URI'] + 1);
} else {
$queryOffset = strlen($_SERVER['REQUEST_URI']);
@mwalters
mwalters / jquery-crash-course.md
Last active July 25, 2023 17:00
A friend needed a crash course in jQuery basics. I thought it might be helpful to capture it. Feel free to suggest corrections / modifications / additions.

Ok, crash course in jQuery and stuff:

Accessing jQuery

jQuery makes a global object, typically referenced by "$". There's also something called no-conflict mode where you'd reference it by "jQuery", but you won't see that too often in what we're doing, but just in case you encounter it, essentially these are the same:

$('.article')
jQuery('.article')

Element Selection