Skip to content

Instantly share code, notes, and snippets.

View xtrasmal's full-sized avatar
🟢
--- 200 OK

Xander xtrasmal

🟢
--- 200 OK
View GitHub Profile
@xtrasmal
xtrasmal / posts.js
Created January 21, 2013 20:08
WP JSON-API Backbone.js-Posts
(function($) {
// MODEL
var Post = Backbone.Model.extend();
// COLLECTION
var PostList = Backbone.Collection.extend({
model: Post,
url: 'http://localhost/Wordpress/Twentytwelve/api/get_recent_posts/',
parse: function(resp) {
<?php
// Database settings
switch($_SERVER['SERVER_NAME']) {
// Local Environment
case 'localhost':
define('DB_NAME', 'db_name');
@xtrasmal
xtrasmal / ideal-gateway.as
Created January 27, 2013 14:15
AS3 iDeal Basic ING Setup iDeal through the iDeal Dashboard. Create a productlist. You need to use deeplinking to handle errors/ cancel / succes !
/* Xander Smalbil
www.videofunk.nl
*/
///////////iDeal
if(paymenttext.text=="iDeal"){
var idealData:String;
var itemNumber:String; // = 1,2,3,4,5,6;
var itemNumber2:String = "33";
var itemPrice:String = "2990";
@xtrasmal
xtrasmal / paypal-gateway.as
Created January 27, 2013 14:19
AS3 PayPal Donate and Buynow
//Listeners
btDonate.addEventListener(MouseEvent.CLICK, donate);
btBuynow.addEventListener(MouseEvent.CLICK, buynow);
//Functions
function donate (event:MouseEvent):void{
var url:String = "https://www.paypal.com/cgi-bin/webscr";
var request:URLRequest = new URLRequest(url);
var paypal_donate:URLVariables = new URLVariables();
@xtrasmal
xtrasmal / css-compress-multiple.php
Last active December 11, 2015 19:28
PHP Compress multiple css files
<?php
header('Content-type: text/css');
ob_start("compress");
function compress($buffer) {
/* remove comments */
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
/* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
@xtrasmal
xtrasmal / description.tpl
Created January 27, 2013 14:28
CS Cart MP3 player in shop. For this you need the following.
/* Xander Smalbil */
// description.tpl
{* $Id: description.tpl 11191 2010-11-11 11:56:01Z klerik $ *}
{** block-description:description **}
{if $attachments_data}
<div id="mp3_attachments">
{foreach from=$attachments_data item="file"}
{if $file.filename|strstr:'.mp3'}
@xtrasmal
xtrasmal / as3.as
Created January 27, 2013 14:33
AS3 Clicktag Flashvar. Making a commercial banner with ClickTag. usage create a flashvar named ClickTag
/* Xander Smalbil */
var paramList:Object=this.root.loaderInfo.parameters;
clickme.addEventListener(MouseEvent.CLICK, openURL);
@xtrasmal
xtrasmal / sticky-footer.css
Last active December 11, 2015 22:18
Sticky footer CSS + HTML
@xtrasmal
xtrasmal / content-submenu.php
Last active December 12, 2015 02:29
Wordpress submenu
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
}
$children = wp_list_pages("title_li=&child_of=". $parent ."&echo=0");
@xtrasmal
xtrasmal / recipe.html
Created March 1, 2013 10:23
Microdata Recipe
<div itemscope itemtype="http://schema.org/Recipe">
<span itemprop="name">Mom's World Famous Banana Bread</span>
By <span itemprop="author">John Smith</span>,
<meta itemprop="datePublished" content="2009-05-08">May 8, 2009
<img itemprop="image" src="bananabread.jpg" />
<span itemprop="description">This classic banana bread recipe comes
from my mom -- the walnuts add a nice texture and flavor to the banana
bread.</span>