Skip to content

Instantly share code, notes, and snippets.

var app = express();
app.set('views', __dirname + '/client/views');
app.set('view engine', 'jade');
app.use(express.logger('dev'))
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.methodOverride());
@andreaj8
andreaj8 / Geolocalizzation
Created July 26, 2013 09:24
Geolocalizzation Titanium
//var Cloud = require('ti.cloud');
Titanium.Geolocation.purpose = "GPS user coordinates";
Titanium.Geolocation.distanceFilter = 2; // set the granularity of the location event
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
// Titanium.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS;
exports.position = function(functionOnSuccess,functionOnError){
locationAdded = false;
@andreaj8
andreaj8 / output
Created September 5, 2013 08:56
e2e tests launched by karam from script
WARN [config]: "/" is proxied, you should probably change urlRoot to avoid conflicts
INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
WARN [launcher]: Can not load "Chrom", it is not registered!
Perhaps you are missing some plugin?
INFO [Safari 6.0.5 (Mac OS X 10.8.4)]: Connected on socket ESjEJOqow0O8qJg5U9xW
Safari 6.0.5 (Mac OS X 10.8.4) Ubmhealth Authentication Should render login page when user navigates to / FAILED
TypeError: 'undefined' is not a function (evaluating '$document.injector()')
Safari 6.0.5 (Mac OS X 10.8.4) Ubmhealth Authentication Should NOT render children page when user is not Logged FAILED
element '#children' click
Selector #children did not match any elements.
@andreaj8
andreaj8 / scenario.js
Created September 5, 2013 08:59
e2e test description
'use strict';
/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
describe('Ubmhealth', function() {
describe('Authentication', function() {
beforeEach(function() {
@andreaj8
andreaj8 / gist:6521502
Created September 11, 2013 09:48
UNIT
INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 29.0.1547 (Mac OS X 10.8.4)]: Connected on socket ltq8bxTuorpUO6NvZVOC
LOG: 'Hello test'
LOG: '2 test'
Chrome 29.0.1547 (Mac OS X 10.8.4) ControllerUnitTest ChildController test FAILED
Error: Unexpected request: GET /child
No more request expected
at Error (<anonymous>)
at $httpBackend (/Users/andreaj/Desktop/zeero.bitbucket.org/ubmhealth/client/tests/lib/angular/angular-mocks.js:934:9)
@andreaj8
andreaj8 / gist:7092500
Created October 21, 2013 23:21
Target Descriptio
var TargetSchema = mongoose.Schema({
id: Number,
cure: {type:mongoose.Schema.Types.ObjectId, ref:'Cure'},
exercise : String,
startate : Date,
criteria : Array,
endDate : Date,
masterizzationCriteria : Object, //{ numero ripetizioni , %}
// leve:Number, // 0 1 2
@andreaj8
andreaj8 / profile.js
Created January 20, 2014 14:24
Titanium Alloy ( 3.2.0) Table View strange behavior
(function() {
$.save.enabled = false;
var u = user.getCurrent();
$.textFName.value = u.custom_fields ? u.first_name + " " + u.last_name : "";
$.textFphone.value = u.custom_fields ? u.custom_fields.number : "";
$.textFmail.value = u ? u.email : "";
$.profilePic.image = u.photo.urls ? u.photo.urls.small_240 : "sample-img.png";
Alloy.Globals.interestStatus = u.custom_fields ? u.custom_fields.interest : [];
var data = $.table.getData();
@andreaj8
andreaj8 / synchronous.js
Last active August 29, 2015 14:07
Node js, Series of http request synchronous
var request = require('request');
var async = require('async');
var array = [];
for (var i = 0; i < 10; i++) {
array.push(function (callback) {
request('www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
json2csv({
data: usersArray,
fields: ['name', 'email', 'gender', 'birthday', 'created', 'address', 'img', 'platform', 'used', 'scratched', 'winning', 'changed', 'welcomeKit', 'gift', 'invalidated', 'games'],
del: ';'
},
function (err, csv) {
if (err) return res.json(500);
res.set({
"Content-Disposition": "attachment; filename=o_o.csv"
});
<html
xmlns="http://www.w3.org/1999/xhtml">
<head/>
<body>
<svg
xmlns="http://www.w3.org/2000/svg" width="300" height="300">
<g transform="translate(100,100)">
<g class="slice">
<path fill="#3182bd" d="m-95.10565162951534,-30.901699437494813a100,100 0 0,1 7.044874666267686e-14,-100l0,0z"/>
<text transform="translate(-29.38926261462363,-40.45084971874739)" text-anchor="middle">20</text>