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 / product.html
Created March 1, 2013 10:27
Microdata Product
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Kenmore White 17" Microwave</span>
<img src="kenmore-microwave-17in.jpg" alt='Kenmore 17" Microwave' />
<div itemprop="aggregateRating"
itemscope itemtype="http://schema.org/AggregateRating">
Rated <span itemprop="ratingValue">3.5</span>/5
based on <span itemprop="reviewCount">11</span> customer reviews
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
@xtrasmal
xtrasmal / getdistance.js
Created March 16, 2013 15:36
GEOLOCATION get distance
var yourUrl = 'http://maps.googleapis.com/maps/api/directions/json?origin=enschede&destination=arnhem&sensor=false';
var xhReq = new XMLHttpRequest();
xhReq.open("GET", yourUrl, false);
xhReq.send(null);
var jsonObject = JSON.parse(xhReq.responseText);
var lat = jsonObject.results[0].geometry.location.lat;
var lng = jsonObject.results[0].geometry.location.lng;
var afstand = parseFloat(jsonObject.routes[0].legs[0].distance.text);
@xtrasmal
xtrasmal / getDistance.js
Last active December 15, 2015 00:59
GEOLOCATION getDistance(start, end);
getDistance = function(start, end) {
var start = start,
end = end,
xhReq = new XMLHttpRequest(),
geoUrl = 'http://maps.googleapis.com/maps/api/directions/json?origin='+start+'&destination='+end+'&sensor=false';
xhReq.open("GET", geoUrl, false);
xhReq.send(null);
var jsonObject = JSON.parse(xhReq.responseText);
//
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'.
//
// e.g. parse.get(
// "Book",
// 123,
// function(response){ console.log(response.toString());}
// );
//
services.factory('parse', function($rootScope, $http) {
@xtrasmal
xtrasmal / clicktag.as
Created April 26, 2013 19:53
AS3 Banner ClickTag (html side)
var paramList:Object=this.root.loaderInfo.parameters;
clickme.addEventListener(MouseEvent.CLICK, openURL);
function openURL(evtObj:MouseEvent):void
{
var request:URLRequest = new URLRequest(paramList["ClickTag"]);
navigateToURL(request, "_blank");
}
@xtrasmal
xtrasmal / AS3.Geolocation.as
Created April 26, 2013 20:03
AS3 Geolocation: display lattitude,longitude,horz.accuracy The application displays the latitude, longitude, and horizontal accuracy of geolocation update events as they are received.
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.GeolocationEvent;
import flash.sensors.Geolocation;
import flash.text.TextField;
import flash.text.TextFormat;
@xtrasmal
xtrasmal / reAttachImages.php
Created April 26, 2013 20:05
WordPress: Re-attach images from media library Put this in the functions.php
<?php
// Extra column at media library
add_filter("manage_upload_columns", 'upload_columns');
add_action("manage_media_custom_column", 'media_custom_columns', 0, 2);
function upload_columns($columns) {
unset($columns['parent']);
$columns['better_parent'] = "Parent";
@xtrasmal
xtrasmal / generate.php
Created May 3, 2013 22:03
Laravel 3 Task generator
<?php
/**
* Laravel Generator
*
* Rapidly create models, views, migrations + schema, assets, tests, etc.
*
* USAGE:
* Add this file to your Laravel application/tasks directory
* and call the methods with: php artisan generate:[model|controller|migration] [args]
@xtrasmal
xtrasmal / angular-config.js
Created May 4, 2013 21:04
Angular JS. Change {{ }} to (( )) so you can use it within Laravel blade templates.
var m = angular.module('myApp', []);
m.config(function($interpolateProvider) { $interpolateProvider.startSymbol('(('); $interpolateProvider.endSymbol('))'); });
return m;
@xtrasmal
xtrasmal / app.js
Created May 13, 2013 23:57
AMD define modules and init
define(['editor', 'settings', 'tags', 'bootstrap'], function (editor, settings, tags) {
return {
initialize: function () {
editor.initialize();
tags.initialize();
settings.initialize();
}
};
});