Skip to content

Instantly share code, notes, and snippets.

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

Manuel Alonso manute

🏠
Working from home
View GitHub Profile
var persons = [
{ name: 'Jhon', age: 21 },
{ name: 'Alice', age: 37 },
{ name: 'Brenda', age: 45 },
{ name: 'Manuel', age: 12 },
{ name: 'Maria', age: 37 }
];
function sortByAge(persons) {
return persons.sort(function(a, b){
@manute
manute / gist:8852537
Last active September 2, 2016 15:41
Riemann Service Down Alerts
;
; Riemann Service Down Alerts
; ===================================================
;
; The index stores the most recent state for any [host, service] pair. Clients
; can search the index for various states with a basic query language. The
; default implementation is a NonBlockingHashMap.
;
(let [my-index (index)
@manute
manute / gist:5780480
Last active December 18, 2015 12:09
Multipart-post document to Scribd
@Grab(group='org.apache.httpcomponents',module='httpclient',version='4.2.5')
@Grab(group='org.apache.httpcomponents',module='httpmime',version='4.2.5')
import org.apache.http.client.HttpClient
import org.apache.http.impl.client.DefaultHttpClient
import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.mime.content.FileBody
import org.apache.http.entity.mime.MultipartEntity
import org.apache.http.HttpResponse
import org.apache.http.HttpEntity
import org.apache.http.util.EntityUtils
@manute
manute / gist:5773960
Created June 13, 2013 14:08
Rest Client groovy for get all documents in scribd
import groovy.json.*
import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import groovy.xml.*
final API_URL = "http://api.scribd.com/api"
final API_KEY = "api_key_scribd"
def restScribd = new RESTClient(API_URL)
@manute
manute / gist:5772239
Last active December 18, 2015 10:59
Scribd Integration api javascript with gsp layout grails
<g:applyLayout name="userProfile">
<html>
<head>
<script type="text/javascript" src='http://www.scribd.com/javascripts/scribd_api.js'></script>
</head>
<body>
<div class="colIzq fleft">
<div id='embedded_doc'></div>
<script type='text/javascript'>
@manute
manute / CroppingController.groovy
Created May 14, 2013 11:26
Cropping image - grails controller
package com.images
import java.awt.image.BufferedImage
import javax.imageio.ImageIO
import grails.converters.JSON
class CroopingController {
def s3ImageService
@manute
manute / crooping.js
Last active January 31, 2016 14:12
Cropping js with jCrop
$(function(){
var CropImage = {
id:'crop_image',
$modal_cropping : $('#modalCroopingImage'),
$div_cropping:$('#cropping'),
jcrop_api:"",
original : {
width: 0,height: 0,url: "",uuid: ""
},
@manute
manute / crooping.html
Last active December 17, 2015 07:39
Gsp for crooping images
<style>
.button-photo {
margin-top: 20px;
margin-left: 20px;
}
div.preview_image {
width: 100px;
height: 100px;
overflow:hidden;
}
@manute
manute / gist:5451435
Last active October 25, 2023 19:28
my zsh config with oh-my-zsh
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
#JAVA_HOME
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
#MAVEN
export M2_HOME=/usr/local/maven-3.0.5
export MAVEN_OPTS=-Xmx1024m
@manute
manute / gist:5435737
Last active December 16, 2015 12:38
Add template with css twitter bootstrap
<html>
<head>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"></link>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
<style>
.popover-all {
position: absolute;
top: 0;
left: 0;