Skip to content

Instantly share code, notes, and snippets.

View marti1125's full-sized avatar
๐Ÿ

Willy Aguirre marti1125

๐Ÿ
View GitHub Profile
function rgb2hex(rgb) {
if ( rgb.search("rgb") == -1 ) {
return rgb;
}
else if ( rgb == 'rgba(0, 0, 0, 0)' ) {
return 'transparent';
}
else {
rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/);
function hex(x) {
function randomUUID() {
var s = [], itoh = '0123456789ABCDEF';
for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10);
s[14] = 4;
s[19] = (s[19] & 0x3) | 0x8;
for (var i = 0; i <36; i++) s[i] = itoh[s[i]];
s[8] = s[13] = s[18] = s[23] = '_';
return s.join('');
@marti1125
marti1125 / gist:5562230
Created May 12, 2013 02:49
Backbone 01 Code School
var Appointment = Backbone.Model.extend({});
var appointment = new Appointment();
appointment.set('title', 'My knee hurts');
var AppointmentView = Backbone.View.extend({
render: function(){
$(this.el).html('<li>' + this.model.get('title') + '</li>');
}
@marti1125
marti1125 / gist:5606707
Created May 19, 2013 04:36
Backbone 02 codeschool
var Appointment = Backbone.Model.extend({
defaults: function (){
return {
title: 'Checkup',
date: new Date()
}
}
});
var Appointment = Backbone.Model.extend({urlRoot: '/appointments'});
@marti1125
marti1125 / gist:5607000
Created May 19, 2013 07:50
Backbone 03 codeschool - view
var AppointmentView = Backbone.View.extend({
tagName: 'li',
className: "appointment",
});
var AppointmentView = Backbone.View.extend({
render: function(){
this.$el.html('<li>' + this.model.get('title') + '</li>');
}
});
@marti1125
marti1125 / gist:5608681
Created May 19, 2013 19:27
Backbone 04 codeschool model and view
var AppointmentView = Backbone.View.extend({
template: _.template('<span><%= title %></span><a href="#">x</a>'),
events: {"click a": "cancel"},
cancel: function() {
this.model.set({cancelled:true});
},
render: function(){
this.$el.html(this.template(this.model.toJSON()));
@marti1125
marti1125 / gist:5609661
Created May 20, 2013 00:10
Backbone 05 codeschool collection
var AppointmentList = Backbone.Collection.extend({
model: Appointment
});
////////////////////////////
var Appointment = Backbone.Model.extend({});
var AppointmentList = Backbone.Collection.extend({
model: Appointment
});
@marti1125
marti1125 / gist:5637712
Last active December 17, 2015 16:19
intruccion para el pull request de mozillians
https://github.com/mozilla/mozillians/blob/master/docs/contribute.rst
hi
10:38 fxa90id hi marti1125
10:38 marti1125 hi giorgos
10:41 giorgos hi marti1125
10:42 marti1125 hi... for bug 797790 https://bug797790.bugzilla.mozilla.org/attachment.cgi?id=751581
10:42 firebot Bug https://bugzilla.mozilla.org/show_bug.cgi?id=797790 nor, --, ---, willy, ASSI, Create Your Profile page error message is ambiguous
10:44 giorgos marti1125, you have a pull request waiting?
10:44 marti1125 no yet..
@marti1125
marti1125 / gist:5654364
Last active December 17, 2015 18:39
badges
Zepto(function($){
var Badge = Backbone.Model.extend({});
var BadgeList = Backbone.Collection.extend({
model: Badge,
url: 'https://coderwall.com/marti1125.json?callback=?',
parse: function(response) {
return response.results;
}
@marti1125
marti1125 / gist:5654476
Created May 26, 2013 23:50
view badges
<script id="badgeTemplate" type="text/template">
<div class="username">
<% _.each(results, function(res) { %>
<li><%= res.username %></li>
<% }); %>
</div>