Skip to content

Instantly share code, notes, and snippets.

View devluis's full-sized avatar

Alberto Hernández devluis

View GitHub Profile
<?php
/* Source: http://www.apphp.com/index.php?snippet=php-get-remote-ip-address */
function makeMyUrlFriendly($url){
$output = preg_replace("/\s+/" , "_" , trim($url));
$output = preg_replace("/\W+/" , "" , $output);
$output = preg_replace("/_/" , "-" , $output);
return strtolower($output);
}
?>
function getSignature() {
//pretty basic function for testing
if ( startupChecks()) { return; }
var email = SpreadsheetApp.getActiveSpreadsheet().getActiveCell().getValue().toString();
if ( email === "" ) {
Browser.msgBox("No email selected", "Please select a cell containing a user's email" , Browser.Buttons.OK);
return;
}
var result = authorisedUrlFetch(email, {});
Browser.msgBox(result.getContentText());
var API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
var mc_base_url = 'http://us7.api.mailchimp.com/1.3/?method=listSubscribe';
var mc_list_id = 'xxxxxxxxxx';
var mc_double_optin = false;
/**
* Uses the MailChimp API to add a subscriber to a list.
*/
function sendToMailChimp_(fn, ln, em, yr){
@devluis
devluis / app.js
Last active August 29, 2015 14:06 — forked from aaronksaunders/app.js
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title: 'Tab 1',
backgroundColor: '#fff'
});
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
layout: 'vertical'
});
var bt1 = Ti.UI.createButton({title: 'send message (method 1)', top: 200});
bt1.addEventListener('click', function(e)
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
var win = Titanium.UI.currentWindow;
var ind=Titanium.UI.createProgressBar({
width:200,
height:50,
min:0,
max:1,
value:0,
style:Titanium.UI.iPhone.ProgressBarStyle.PLAIN,
top:10,
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Eliminar archivo con PHP y jQuery Ajax</title>
<!-- Bootstrap-->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- jQuery-->
@devluis
devluis / demo.php
Created March 15, 2014 04:02 — forked from Swader/demo.php
<?php
session_start();
$_SESSION['count'] = time();
$image;
?>
<title>demo.php</title>
<body style="background-color:#ddd; ">
<?php
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software