Skip to content

Instantly share code, notes, and snippets.

View marti1125's full-sized avatar
🐍

Willy Aguirre marti1125

🐍
View GitHub Profile
var dial = document.querySelector("#dial");
if (dial) {
dial.onclick = function () {
var call = new MozActivity({
name: "dial",
data: {
number: "+46777888999"
}
});
}
@marti1125
marti1125 / gist:5802947
Created June 18, 2013 05:56
[Solution] Git pull problems
Here's a probable use-case, from the top:
You're going to pull some changes, but oops, you're not up to date:
> git fetch origin
> git pull origin master
From ssh://[email protected]:22/projectname
* branch master -> FETCH_HEAD
Updating a030c3a..ee25213
error: Entry 'filename.c' not uptodate. Cannot merge.
@marti1125
marti1125 / gist:5815621
Created June 19, 2013 16:17
DatePicker
Backbone.Form.editors.YearPicker = Backbone.Form.editors.Text.extend({
initialize: function(options) {
Backbone.Form.editors.Text.prototype.initialize.call(this, options);
//this.$el.addClass('datepicker input-small-custom');
},
getValue: function() {
var value = this.$el.val();
if (value) {
return moment(value).format('YYYY-MM-DD HH:mm:ss');
@marti1125
marti1125 / gist:5852824
Created June 24, 2013 19:33
backbone form collection
var tipoeventualidad = Backbone.Model.extend({
toString: function(){ return this.get("descripcion"); }
});
var tipoeventualidadesCollection = Backbone.Collection.extend({
model: tipoeventualidad,
url: 'tipoeventualidades/listaporasignarconceptoplanilla'
});
var collectionEvent = new tipoeventualidadesCollection();
@marti1125
marti1125 / gist:5859861
Created June 25, 2013 16:17
Backgrid events examples
grid.collection.on("backgrid:editing", function(e){
alert('editando..');
});
grid.collection.on("backgrid:selected", function (model, selected) {
alert('hola');
});
@marti1125
marti1125 / gist:5898206
Created July 1, 2013 03:36
Force git to overwrite local files on pull
git reset --hard HEAD
git pull
@marti1125
marti1125 / gist:5898481
Created July 1, 2013 05:07
get Min in Array dimesional
var arr = [[1, 5], [4, 7], [3, 8], [2, 3],
[12, 4], [6, 6], [4, 1], [3, 2],
[8, 14]];
console.log(Math.min.apply(Math, arr.map(function(i) {
return i[1];
})));
@marti1125
marti1125 / gist:5945134
Last active December 19, 2015 11:08
mi Posicion
// Obtener posicion
function miPosicion(callback) {
if (!navigator.geolocation){
console.log("Geolocation is not supported by your browser");
return false;
}
function success(position) {
var latitude = position.coords.latitude;
@marti1125
marti1125 / gist:5949765
Last active December 19, 2015 11:39
resultado
$.getJSON('js/estaciones.json', function(response){
$.each(response, function(index, item){
$.each(item, function(index, result){
$('.estaciones').append('<li id="IdEstacion" data-estacion="'+result.estacion+'"><p class="nombreEstacion">Estación <b>'+result.estacion+'</b></p></li>');
});
});
});
/*$.ajax({
async: true
@marti1125
marti1125 / gist:5952483
Created July 8, 2013 21:04
backgrid and groove in play framework
var ObjectModelCentroPeriodoDto = Backbone.Model.extend({});
var ObjectsCentroPeriodoDto = Backbone.Collection.extend({
model: ObjectModelCentroPeriodoDto,
url: "clases/listSesionesPorClase?idClase=${clase.id}"
});
collectionCentroPeriodoDto = new ObjectsCentroPeriodoDto();
var columnsCentroPeriodoDto = [