Skip to content

Instantly share code, notes, and snippets.

View gastonsoto's full-sized avatar

Gaston gastonsoto

View GitHub Profile
function leptonOptiShow(targetIframe="leptonIframeContainer",targetComponent="") {
var optiContainer = document.getElementById(targetIframe);
optiContainer.classList.add("opti-on");
var newURL = "https://optionline-dev.herokuapp.com/empresa/mariano/opti?access_token=anGteR_zuBLkJDQMHwyk&refresh=true&id_msg=" + targetComponent;
document.getElementById("myIframe").src = newURL
//Agregar clase opti-on para que el contenedor del optimizador sea visible
var optiContainer = document.getElementById("leptonIframeContainer");
optiContainer.classList.add("opti-on");
//Remover clase opti-on para que el contenedor del optimizador sea visible
var optiContainer = document.getElementById("leptonIframeContainer");
optiContainer.classList.remove("opti-on");
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
@gastonsoto
gastonsoto / 0_usage.md
Created November 14, 2015 03:39 — forked from Overbryd/0_usage.md
Auto-refreshing XOAuth token system for Google

Usage

Simple as XOauthSession.access_token.

First time usage, either create a yaml file yourself or:

Setup your app at Google developer console. There you follow the menu "APIs & auth" > "Credentials". Click "Create new Client ID" and select "Installed Application" and then "Other". Download oauth2.py and execute the following with the credentials of the Google Developer console.

Class Hackeala {
/* Every problem has an input value that determines the operation. Instantiate the class with the given input. */
function __construct($input = ''){
$this->input = $input;
}
/* Hexadecimal numbers are index starting from 1. Substract on odd keys and add on even keys. Find the ASCII equivalent to every single resuting hex number for the final asnwer. */
@gastonsoto
gastonsoto / ca_api.php
Last active April 4, 2023 19:40
Sistema de tracking de correo del correo argentino.
<?php
$ch = curl_init();
/* Numero de pieza: Para envios nacionales solo numeros. Para internacionales alfanumerico.
** Codigo alfanumerico ej. CW123456789US
*/
$id = $_GET['id'];
function imageExists(url, callback) {
var img = new Image();
img.onload = function() { callback(true); };
img.onerror = function() { callback(false); };
img.src = url;
}
var imageUrl = 'http://www.google.com/images/srpr/logo.png';
imageExists(imageUrl, function(exists) {
console.log('RESULT: url=' + imageUrl + ', exists=' + exists);
<?php
$data = array(
'payment' => 'bankdeposit',
'customer'=> array(
'email' => '[email protected]',
'name' => 'Guest Customer',
'address' => 'Address 123',
'phone' => '123456',
'city' => 'City',
@gastonsoto
gastonsoto / Download_Images.php
Last active December 18, 2015 01:09
Download an image from a given URL and create a thumbnail.
<?php
class Download_Images {
var $source;
var $save_to;
var $set_extension;
var $quality;
function download($method = 'curl')
@gastonsoto
gastonsoto / Magento_updateProductCategories.php
Last active December 18, 2015 00:19
Update each product with all the parent categories of each last level category of a category tree. You can use this gist, when you have products that only have the last child category of a category tree assigned. Tested on Magento 1.7.0.2.
<?php
require_once 'app/Mage.php';
Mage::app();
$pids = array();
$products = Mage::getModel('catalog/product')
->getCollection();