Skip to content

Instantly share code, notes, and snippets.

View meltingice's full-sized avatar

Ryan LeFevre meltingice

View GitHub Profile
<?
private function parse_view($html){
$html = preg_replace(
array(
"/\{using ([^}]*)\}/i",
"/\{include ([^}]*)\}/i",
"/\{func ([A-Za-z_]*)->([^}]*)\(([^\)]*)\)\}/i"
),
array(
"<?
== About this Gist ==
I can't figure out wtf is going on here. Something strange with variable scope that I can't quite wrap my mind around.
If anyone knows the solution, please email me at meltingice@meltingice.net
This is a huge generalization of my code... some of the functions here aren't even a part of my codebase,
but they will still produce the same result and they are easier to understand because of their simplicity.
Also, I am using either PHP 5.3.0 or PHP 5.2.8 for this code.
== Where to Start ==
<?php
/*
* Osimo - next-generation forum system
* Licensed under GPLv3 (GPL-LICENSE.txt)
*
* os-includes/bbcode/bbparser.php - osimo's bbcode parser
* This can be used on any site, just call bb2html()
*/
function bb2html($post)
<? get('data')->load_post_list(); ?>
<? get('theme')->include_header(); ?>
<div id="content">
<div class="thread_title">
<h1><? get('data')->thread_title(); ?></h1>
<h2><? get('data')->thread_description(); ?></h2>
</div>
<? if(get('data')->are_posts()): while(get('data')->has_posts()): ?>
var yourVar;
$.ajax({
type:'POST',
url:'someurl',
data:someData,
success: function(data){
yourVar = data;
}
});
var artifact;
$.ajax({
type: "GET",
url: file,
function __autoload($class){
$classes = array(
'OsimoBBParser'=>'bbparser',
'OsimoForum'=>'forum',
'OsimoModel'=>'osimomodel',
'OsimoPost'=>'post',
'OsimoThread'=>'thread',
'OsimoUser'=>'user'
);
$modules = array(
function OsimoModal(options){
this.options = {
'width' : 500,
'height' : 400,
'modal' : true,
'draggable' : false,
'showClose' : true,
'styles' : {}
};
#!/usr/bin/php
<?
# some useful file paths to rememebr
define('NGINX_CONFIG_ROOT', "/etc/nginx/sites-enabled/");
if($_SERVER['argc'] <= 1) {
show_help_msg();
} else {
$new_domain = trim($_SERVER['argv'][1]);
@meltingice
meltingice / jsonpfu-example.js
Created October 19, 2010 04:21
An example of how JSONP-Fu works.
/*
* In order to include libraries, we need to know
* the absolute path to the jsonp-fu directory.
*
* BTW, jfu is a shortcut to jsonpfu that is defined
* as a part of the library.
*/
jfu.set_path('/path/to/jsonp-fu/');
/*