Skip to content

Instantly share code, notes, and snippets.

View tonybolanyo's full-sized avatar
🏠
Working from home

Tony G. Bolaño tonybolanyo

🏠
Working from home
View GitHub Profile
@tonybolanyo
tonybolanyo / jQuery abrir enlace en nueva ventana
Last active August 29, 2015 14:23
Abrir URL en nueva ventana con elementos mínimos
$(document).ready(function(){
$('a.open-window').click(function(){
window.open(this.href, 'newWindow', 'menubar=0, scrollbars=1, width=780, height=900, top=10');
return false;
});
});
@tonybolanyo
tonybolanyo / html5-template.js
Created September 7, 2015 07:58
Plantilla para archivo HTML5: jQuery 1.11.3, html5shiv 3.7.2, respondjs 1.4.2, ie10-viewport-bug-workaround
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Estas tres etiquetas *DEBEN* ir las primeras en la cabecera;
cualquier otra etiqueta debe aparecer *DETRÁS* de estas tres -->
<meta name="description" content="">
<meta name="author" content="Tony G. Bolaño">
@tonybolanyo
tonybolanyo / def-vars.json
Last active September 7, 2015 10:22
Esqueleto proyecto grunt para plantillas HTML5
{
"title": "Plantilla HTML5",
"author": "Tony G. Bolaño",
"date": "septiembre 2015",
"description": "Plantilla HTML5 con referencia a jQuery, html5shiv, Respond.js, ie10-viewport-bug-workaround"
}
@tonybolanyo
tonybolanyo / Gruntfile.js
Last active December 15, 2015 14:22
[blog.tonygb.com] Gruntfile para mis temas web
module.exports = function(grunt) {
var cleanCssOptions = {
advanced: true
}
// configura las tareas
grunt.initConfig({
clean: {
@tonybolanyo
tonybolanyo / backup.py
Last active October 20, 2016 20:33
Scripts para backup de servidor web en hosting compartido
import datetime
import paramiko
import socket
import sys
import traceback
paramiko.util.log_to_file('backup.log')
server = 'url.example.com'
username = 'username'
@tonybolanyo
tonybolanyo / resize.py
Created April 26, 2017 13:11
Python: redimensionar imágenes rellenando con un color de fondo
import logging
import os
from PIL import Image
logger = logging.getLogger(__name__)
logging.basicConfig(filename='resize.log', level=logging.DEBUG)
IMG_SIZE = (800, 800)
IMG_MODE = 'RGBA'
IMG_BACKGROUND = (255, 255, 255, 255)
@tonybolanyo
tonybolanyo / pushover_handler.py
Created May 12, 2017 13:40
Using pushover from django
import logging
import httplib
import urllib
PUSHOVER_APPLICATION_TOKEN = "YOUR_TOKEN_HERE"
PUSHOVER_LOG_USER_TOKENS = [
"USER_TOKEN_HERE", # Joe the admin
]
class PushoverHandler(logging.Handler):
@tonybolanyo
tonybolanyo / editExistingPdf.py
Created May 13, 2017 16:44 — forked from kzim44/editExistingPdf.py
Edit an existing PDF using Python
from pyPdf import PdfFileWriter, PdfFileReader
import StringIO
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
packet = StringIO.StringIO()
# create a new PDF with Reportlab
can = canvas.Canvas(packet, pagesize=letter)
can.drawString(100,100, "Hello world")
can.save()
@tonybolanyo
tonybolanyo / db.json
Created October 2, 2017 09:58
npm-paralelo (blog Tony G. Bolaño)
{
"posts": [{
"id": 1,
"title": "json-server",
"author": "typicode"
}],
"comments": [{
"id": 1,
"body": "some comment",
"postId": 1
@tonybolanyo
tonybolanyo / path.js
Last active November 5, 2017 10:13 — forked from creationix/path.js
Simple path join and dirname functions for generic javascript
'uses strict';
// Joins path segments. Preserves initial "/" and resolves ".." and "."
// Does not support using ".." to go above/outside the root.
// This means that join("foo", "../../bar") will not resolve to "../bar"
const join = function(/* path segments */) {
// Split the inputs into a list of path commands.
var parts = [];
for (var i = 0, l = arguments.length; i < l; i++) {
parts = parts.concat(arguments[i].split('/'));