Skip to content

Instantly share code, notes, and snippets.

View mikevalstar's full-sized avatar

Mike Valstar mikevalstar

View GitHub Profile
app.post('/admin/ajax/theme.:format', function(req, res){ aServ.ajax.theme(req, res); });
theme: function(req, res){
if( !this._start(req, res) ) return;
var Status = this.Status;
cb_func = function(theme, error){
if(error){
res.send({ status: 404, message: "Theme not found: " + error});
return;
<?PHP
class article extends basedata{
var $_table = 'article';
var $_keycol = 'id_article';
var $_cols = array('title', 'short_txt', 'long_txt', 'posted', 'is_welcome', 'is_featured');
var $_createbycol = 'created_by';
var $_createwhencol = 'created_when';
var $_delbycol = 'deleted_by';
<?PHP
class event extends basedata {
var $_table = 'event';
var $_keycol = 'id_event';
var $_cols = array('title', 'from_date', 'to_date', 'summary', 'content', 'resource_type', 'event_type',
'city', 'country', 'published');
var $_createbycol = 'created_by';
var $_createwhencol = 'created_when';
SELECT SQL_CALC_FOUND_ROWS
`group_user`.*,
concat(`name_first`, ' ', `name_last`) as `full_name`,
`name_first`,
`name_last`,
`gender`,
`email`,
`img`,
`country`,
`place`,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
$urlchunk = explode('/', trim($pageurl, '/'));
if(count($urlchunk) > 0 && substr($urlchunk[count($urlchunk) - 1],0,1) == '?') {
unset($urlchunk[count($urlchunk) - 1]);
if(count($urlchunk) == 0) $urlchunk[0] = '';
}
@mikevalstar
mikevalstar / thing.js
Created June 24, 2011 17:13
Replace audio with internals
$('audio').each(function(){
$(this).parent().html($(this).html());
}
@mikevalstar
mikevalstar / dom.php
Created June 28, 2011 22:42
domgrabber
<?PHP
function update_basecamp_img($filename){
if($this->basecamp_login != "" && $this->basecamp_password != ""){
//echo "Updating basecamp image";
$S = new Snoopy();
/* Login the user */
$login_url = "https://" . BasecampSiteURL . '/login';
$S->fetch($login_url);
$S->setcookies();
<?php
$html = file_get_contents("http://finance.yahoo.com/futures?t=energy");
$dom = new DOMDocument();
$dom->recover = true;
$dom->strictErrorChecking = false;
@$dom->loadHTML($html);
$table = $dom->getElementsByTagName('table');
echo "Table: <br/>";
<?PHP
while(true){
$x++
$y = 0;
while($y < 5000){
file_get_contents("http://yoursite.com/img/img_$x$y.jpg");
$y++;
}
}
var StaticPages = module.exports = function StaticPages(){};
StaticPages.prototype = {
initPages: function(app){
// Routes
app.get('/', function(req, res){
res.render('index', {
title: 'Home'