Skip to content

Instantly share code, notes, and snippets.

View ideiudicibus's full-sized avatar

ignazio de iudicibus ideiudicibus

View GitHub Profile
@ideiudicibus
ideiudicibus / Beanutils.java
Created May 10, 2011 14:17
Merge two java beans useful when discovering differences
class Beanutils{
//merge two bean by discovering differences
private <M> void merge(M target, M destination) throws Exception {
BeanInfo beanInfo = Introspector.getBeanInfo(target.getClass());
// Iterate over all the attributes
for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) {
// Only copy writable attributes
if (descriptor.getWriteMethod() != null) {
@ideiudicibus
ideiudicibus / registrar.js
Created May 13, 2011 12:45 — forked from mheadd/registrar.js
A simple SIP registrar that uses Node.js and Redis
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
sip.start({},function(request) {
@ideiudicibus
ideiudicibus / registrar.js
Created May 13, 2011 12:45 — forked from chrismatthieu/registrar.js
Node.JS SIP Registrar
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
sip.start({},function(request) {
@ideiudicibus
ideiudicibus / svn_recursive_add.sh
Created May 30, 2011 17:08
svn recursive add from local directory
#svn recursive add script to be used on current directory
#!/bin/sh
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
svn commit -m "$1"
@ideiudicibus
ideiudicibus / testPaginegialleCinema.js
Created September 3, 2012 16:11
paginegialle.it cinema web scraping
var request = require('request'),
cheerio = require('cheerio'),
url= 'http://www.paginegialle.it/cinema-programmazione/Roma%20(RM)',
ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2';
var parsePage = function(error, response, body) {
if (error || response.statusCode != 200) {
console.log(error);
}
@ideiudicibus
ideiudicibus / clone-google-spreadsheet.gs
Last active April 5, 2016 12:20
google apps script GAS clone a spreadsheet
//in client try to use hello js https://adodson.com/hello.js/
function doGet(e) {
//parameters
var fileId = e.parameters.fileId;
var fileName=e.parameters.name;
var editor=e.parameters.editor;
//clone the file
var f= DriveApp.getFileById(fileId).makeCopy(fileName);
f.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.VIEW);
f.addEditor(editor);
function doGet(e) {
if(typeof e !== 'undefined')
return ContentService.createTextOutput(JSON.stringify(e.parameter));
}
function doPost(e) {
if(typeof e !== 'undefined')
Attaching to docker_load-balancer_1, docker_hystrix-dashboard_1, docker_web-client_1, docker_gateway_1, docker_business-intelligence-service_1, docker_web-content-service_1, docker_zipkin-web_1, docker_core_1, docker_zipkin_1, docker_logstash_1, docker_kibana_1, docker_configuration_1, docker_business-intelligence-service-postgres-database_1, docker_base_1, docker_web-content-service-postgres-database_1, docker_discovery_1, docker_elasticsearch_1, docker_redis_1, docker_rabbitmq_1, docker_core-postgres-database_1
load-balancer_1 | WARNING: no logs are available with the 'gelf' log driver
hystrix-dashboard_1 | WARNING: no logs are available with the 'gelf' log driver
web-client_1 | WARNING: no logs are available with the 'gelf' log driver
gateway_1 | WARNING: no logs are available with the 'gelf' log driver
business-intelligenc
@ideiudicibus
ideiudicibus / meteor-wrapasync.md
Created September 11, 2017 14:43 — forked from DanAncona/meteor-wrapasync.md
Meteor vs. the Twitter API via wrapAsync and Twit

Twit and other Node libraries don't always quite drop into Meteor's reactive architecture right out of the box. Luckily Meteor makes adapting them super-duper easy with wrapAsync. It was so easy that I naturally tried all the more difficult ways first! Since I didn't find a nice gist or StackOverflow example, please enjoy this one.

In the template -

{{#with pos}}
  {{#if ready}}
    {{> singlePosition data }}
@ideiudicibus
ideiudicibus / decaffeinate_coffeescript_files.txt
Last active November 22, 2017 12:15
convert and remove coffeescript files
I don't like coffeescript syntax and I discovered that I'm not alone.
This project does the work:
http://decaffeinate-project.org/
usage:
# install locally
$ npm install -g decaffeinate
# convert a single file