This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
### --- Snip --- ### | |
App::after(function($request, $response) | |
{ | |
// HTML Minification | |
if(App::Environment() != 'local' and $response instanceof Illuminate\Http\Response) | |
{ | |
$output = $response->getOriginalContent(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
class Model(object): | |
__json_file = None | |
__dict_file = None | |
def __init__(self, *args, **kwargs): | |
for item in kwargs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mov-to-gif() { | |
ffmpeg -i $1 -vf "scale=1024:-1:flags=lanczos" -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=0 --delay=7 # | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
import functools | |
from django.core.cache import cache | |
class cached(object): | |
"""Save the return of the function on the cache. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# 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 |
OlderNewer