Skip to content

Instantly share code, notes, and snippets.

View jgermade's full-sized avatar
🎨
Working from home

Jesús Germade jgermade

🎨
Working from home
View GitHub Profile
{
"toc": true,
"merchant": {
"confirmation_url": "https://demo.aplazame.com/confirm",
"cancel_url": "/demo-cancel.html",
"success_url": "/demo-success.html"
},
"customer": {
"id": "140",
"email": "[email protected]",
.tree-view {
font-family: 'Souce Sans Pro', 'Ubuntu Mono', Monaco, monospace;
font-size: 17px !important;
.list-tree .entry {
line-height: 1.5;
.name {
color: #aaa;
}
var arrayShift = [].shift;
function _deep_merge (dest, src) {
if( typeof dest !== typeof src ) {
return src;
}
if( src instanceof Array ) {
[].push.apply(dest, src);
return dest;
}
{
"host": "location",
"toc": true,
"merchant": {
"confirmation_url": "http://checkout.ovh2.germade.es/success.html",
"cancel_url": "/demo-cancel.html",
"success_url": "/demo-success.html"
},
"customer": {
"id": "140",
function compileMessage (message) {
return new Function('obj', 'with(obj){ return \'' +
message.replace(/\n/g, '\\n').split(/{{([^{}]+)}}/g).map(function (expression, i) {
return i%2 ? ( '\'+(' + expression.trim() + ')+\'' ) : expression;
}).join('') +
'\'; }');
}
function delayed (fn, args) {
var _this = this, _args = args || arguments;
setTimeout(function () {
fn.apply(_this, _args);
}, 0);
}
function once (fn, nextValue) {
var result, hasNextValue = arguments.length > 1;
return function () {
@jgermade
jgermade / once.js
Last active November 22, 2016 20:05
function once (fn) {
var result;
return function () {
if( fn ) {
result = fn.apply(this, arguments);
fn = null;
}
return result;
};
}
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if(request.readyState === 4) {
if(request.status === 200) {
console.log(request.responseText);
} else {
console.error(request.status, request.statusText, request.responseText);
}
}
<?php
// si tienes instalado php-curl, puedes usar la siguente función:
function authorize_order ($aplazame_private_key, $order_id, $is_production = false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.aplazame.com/orders/$order_id/authorize");
curl_setopt($ch, CURLOPT_POST, true);
// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
// esto es para no incluir la cabecera de la respuesta
@jgermade
jgermade / get-toolbox.sh
Created August 2, 2016 16:25 — forked from jacobtomlinson/get-toolbox.sh
Docker toolbox for linux
#!/bin/bash
# A quick script to install Docker Engine and Compose
# Run with sudo
# Install Docker Engine
curl -sSL https://get.docker.com/ | sh
# Start Docker
# TODO update to handle multiple distros
service docker start