Skip to content

Instantly share code, notes, and snippets.

View imme-emosol's full-sized avatar
😱
sto der skjælvende av angst – og følte et stort uendelig skrik gjennom naturen

immeëmosol imme-emosol

😱
sto der skjælvende av angst – og følte et stort uendelig skrik gjennom naturen
View GitHub Profile
@imme-emosol
imme-emosol / .htaccess
Last active February 15, 2023 14:31
apache's mod_rewrite to index.php if 404 unfound/not-found
<IfModule rewrite_module>
#OR<IfModule mod_rewrite.c>
#OR<IfModule mod_rewrite.so>
# according to apache-documentation, followsymlinks is needed for mod_rewrite
Options +FollowSymLinks
# Enable the RewriteEngine
RewriteEngine On
# if needed add(/uncomment) the following:
#RewriteBase /path/to/file/to/be/found/
# check if the request is not an existing file
@imme-emosol
imme-emosol / gist:722691
Created December 1, 2010 00:10
*nix( unix, linux, macosx?) workaround for php spl_autoload
<?php
set_include_path( './classes/' . PATH_SEPARATOR . get_include_path() );
spl_autoload_extensions( '.php , .class.php' );
spl_autoload_register();
function linux_namespaces_autoload ( $class_name )
{
/* use if you need to lowercase first char *
$class_name = implode( DIRECTORY_SEPARATOR , array_map( 'lcfirst' , explode( '\\' , $class_name ) ) );/* else just use the following : */
$class_name = implode( DIRECTORY_SEPARATOR , explode( '\\' , $class_name ) );
static $extensions = array();
@imme-emosol
imme-emosol / regex_url.php
Created December 5, 2010 09:37
uri checkers testbed in php
<?php
/*
* Note: You'll need PHP5.3 to run this script!
*/
/*
* Patterns originate from http://mathiasbynens.be/demo/url-regex
*
* Note: None of the patterns had the S-modifier. I added it to speed up the tests.
<?php
/**
** @file autoloader.inc.php
** @author immeëmosol (programmer dot willfris at nl)
** @date 2010-12-06
** Created: lun 2010-12-06, 14:05.13 CET
** Last modified: lun 2010-12-06, 15:19.01 CET
**/
$classes_directory = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'classes';
@imme-emosol
imme-emosol / .vimrc
Created December 6, 2010 22:47
imavimrc -- my personal vimrc( w/ vim mostly used for php.)
" some things are probably in this file twice, some don't work.
" furthermore i expect the following files and directories to exist:
" ~/.vim/backups
" ~/.vim/swap_files
" ~/.vim/skeletons ( in it files: my.phtml my.php my.class.php my.js
" in the files certain character-sequences are expected, e.g. <CLASS_NAME>
" too find the other sequences and or places where these paths are used the following regex can be used
" (search for a regex in vim by typing a forward slash `/` in "normal mode",
" after that you can type the following( wihtout the leading double quote `"` and space ` ` of course):
" \~\/\.vim
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
//
// the regular expression composed & commented
// could be easily tweaked for RFC compliance,
// it was expressly modified to fit & satisfy
// these test for an URL shortener:
@imme-emosol
imme-emosol / IfException.php
Created October 25, 2011 13:57
IfException.php
<?php
/**
* @file IfException.php
* @author
* - immeëmosol (programmer dot willfris at nl)
* @date 2011-09-22
* Created: ĵaŭ 2011-09-22, 02:14.46 CEST
* Last modified: ĵaŭ 2011-09-22, 05:02.52 CEST
**/
@imme-emosol
imme-emosol / naam.html
Created November 24, 2011 16:58
stukje javascript eerstejaars
<!DOCTYPE html>
<html>
<head>
<title>Naam-ding</title>
<script type="text/javascript">
var naam = function ()
{
var geefNaam = function ( e )
{
var naam = document.getElementById( 'naam' ).value;
@imme-emosol
imme-emosol / producten.php
Created December 2, 2011 09:19
productenoverzicht
<?php #
# meer informatie over MySQLi is te vinden op http://php.net/mysqli
# Verbinding maken met de database.
$database_connectie = new MySQLi(
# verbindingsgegevens: host, database-username, database-userpassword, database-name
'localhost' , 'root' , '' , 'webwinkel'
);
# Vraag klaarzetten die aan databaseserver gesteld gaat worden
$sql = "SELECT * FROM `producten` LIMIT 0, 30 ";
# Vraag aan databaseserver stellen en antwoord onthouden/opslaan in variabele $resultaat
@imme-emosol
imme-emosol / product.php
Created December 9, 2011 08:32
product detailpagina
<?php
$database_connectie = new MySQLi(
'localhost' , 'root' , '' , 'webwinkel'
);
$id = $database_connectie->real_escape_string( $_GET[ 'id' ] );
$sql = "SELECT * FROM `producten` WHERE product_id='$id' LIMIT 1 ";
$resultaat = $database_connectie->query( $sql );