Skip to content

Instantly share code, notes, and snippets.

Avatar

Juanje Ojeda juanje

View GitHub Profile
@juanje
juanje / index.html
Last active Aug 29, 2015
Testing cartodb.js with Chart.js
View index.html
<!doctype html>
<html>
<head>
<title>Testing cartodb.js with Chart.js with some random data</title>
<script src="http://www.chartjs.org/assets/Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<style>
canvas{
}
@juanje
juanje / index.html
Last active Aug 29, 2015
Playas con bandera azul en España, por regiones
View index.html
<!doctype html>
<html>
<head>
<title>Playas con bandera azul en España, por regiones</title>
<script src="http://www.chartjs.org/assets/Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<style>
canvas{
}
@juanje
juanje / index.html
Last active Aug 29, 2015
Las playas más cercanas
View index.html
<html>
<head>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.ie.css" />
<![endif]-->
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<style>
html, body {width:100%; height:100%; padding: 0; margin: 0;}
#map { width: 100%; height:90%; background: black;}
@juanje
juanje / Tipical bash script option menu
Created Dec 3, 2010
This is a very simple shellscript menu.
View Tipical bash script option menu
#!/bin/bash
while [ "$#" -gt 0 ]
do
case $1 in
-h | --help)
echo "Show program help for $(basename $0)"
shift
;;
View init.rb
#
# vendor/plugins/redmine_gist/init.rb
#
require 'redmine'
require 'open-uri'
Redmine::Plugin.register :redmine_gist do
name 'Redmine Gist embed plugin'
author 'Yasushi Abe <yasushi.abe@gmail.com>'
description 'This is a plugin for Redmine'
@juanje
juanje / gist:1012207
Created Jun 7, 2011
Delete a remote branch
View gist:1012207
# Let's say you've created a branch 'my_changes' you have pushed to Github, but now
# you want to remove it.
# Let's also set the remote which point to your Github account is 'origin'
# These are the needed steps:
# 1 - Delete the branch locally
git -D my_changes
# 2 - Push those changes (the delete) to Github
@juanje
juanje / get_exe_from_hwtype.py
Created Aug 11, 2011
Get the app that should be launched for a specific hardware Type
View get_exe_from_hwtype.py
#!/usr/bin/env python
from xdg import IniFile, BaseDirectory, DesktopEntry
from os import path
import pynotify
# Desktop Notifications Specification: http://www.galago-project.org/specs/notification/0.9/index.html
title = "HANS: Device detected"
message = "An ebook has been plugged"
timeout = pynotify.EXPIRES_DEFAULT
@juanje
juanje / update-hwmime.py
Created Aug 11, 2011
A protoype of a update script for the hardware mimetypes
View update-hwmime.py
#!/usr/bin/env python
from xdg import BaseDirectory
from xdg.IniFile import IniFile
from os import path
from glob import glob
desktop_files = []
for dirname in BaseDirectory.xdg_data_dirs:
@juanje
juanje / gist:1210545
Created Sep 12, 2011
Ruby class template based on attribs and a passed hash
View gist:1210545
class Base
def initialize args
update args
end
def update args
args.each do |k,v|
send "#{k}=", v if respond_to? k
end
@juanje
juanje / gist:1213900
Created Sep 13, 2011
Ruby class template based on attribs and a passed hash using mixins
View gist:1213900
module Base
def initialize args
update args
end
def update args
args.each do |k,v|
instance_variable_set "@#{k}", v if respond_to? k
end