Skip to content

Instantly share code, notes, and snippets.

View RodrigoEspinosa's full-sized avatar
:bowtie:
 

Rodrigo Espinosa Curbelo RodrigoEspinosa

:bowtie:
 
View GitHub Profile
@RodrigoEspinosa
RodrigoEspinosa / definitions.js
Last active August 29, 2015 14:01
Get this: week, month and year range Date prototype
Date.prototype.getThisWeek = function () {
var y = this.getFullYear(),
m = this.getMonth(),
f = this.getDate() - this.getDay(),
l = f + 6;
return [new Date(y, m, f), new Date(y, m, l)];
};
Date.prototype.getThisMonth = function () {
@RodrigoEspinosa
RodrigoEspinosa / model.py
Created August 19, 2014 03:16
JSON File Oriented Model
import json
class Model(object):
__json_file = None
__dict_file = None
def __init__(self, *args, **kwargs):
for item in kwargs:
@RodrigoEspinosa
RodrigoEspinosa / update_index.py
Last active August 29, 2015 14:09
Custom haystack update_index command that disable logging
import logging
from haystack.management.commands import update_index
class Command(update_index.Command):
help = 'Custom haystack update index command that disable logging'
def handle(self, *args, **option):
var Blessed = require('blessed');
var screen = Blessed.screen({
smartCSR: true,
useBCE: true
});
var ChatHistory = function (options) {
if (!(this instanceof Blessed.Node)) {
return new ChatHistory(options);
@RodrigoEspinosa
RodrigoEspinosa / gist:3663781
Created September 7, 2012 06:21
DOM to JSON parser for jQuery
function DOM2JSON(){
var Items = new Array;
$(".contenedor").each(function(index){
var label = $(this).children("label").text();
var type = $(this).children("input, textarea")[0];
var name = $(this).children("input, textarea").attr("name") || null;
var placeholder = $(this).children("input, textarea").attr("placeholder") || null;
Items.push(new Item(label, type, name, placeholder));
});
return Items;
<?php
### --- Snip --- ###
App::after(function($request, $response)
{
// HTML Minification
if(App::Environment() != 'local' and $response instanceof Illuminate\Http\Response)
{
$output = $response->getOriginalContent();
@RodrigoEspinosa
RodrigoEspinosa / update-ghost.sh
Created December 26, 2015 21:20
Update Ghost w/PM2
##
# Based on http://support.ghost.org/how-to-upgrade/
# Backup the content.
# TODO: Add date suffix.
cp -R ./content /tmp/content-backup
cp ./config.js /tmp/config.js-backup
# Download latest version of Ghost.
curl -LOk https://ghost.org/zip/ghost-latest.zip
@RodrigoEspinosa
RodrigoEspinosa / jQuery.fileUpload.js
Created January 17, 2014 19:12
jQuery ajax file upload plugin using FormData JavaScript Object.
(function ($) {
$.fn.fileUpload = function (options) {
var opts = $.extend({}, $.fn.fileUpload.defaults, options);
this.on('change', function (event) {
event.preventDefault();
createAjaxRequest(createFormData(this));
});
function createFormData (self) {

Keybase proof

I hereby claim:

  • I am RodrigoEspinosa on github.
  • I am rec (https://keybase.io/rec) on keybase.
  • I have a public key whose fingerprint is 03EF 561A 10C2 77E6 1A76 EDDF AA1E BB6C 30D9 DA76

To claim this, I am signing this object: