Skip to content

Instantly share code, notes, and snippets.

@Marakuba
Marakuba / nginx.conf
Created December 12, 2015 11:24 — forked from phpdude/nginx.conf
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
# -*- coding: utf-8 -*-
from django.db import connection
class SQLLogMiddleware:
def process_response(self, request, response):
time = 0.0
for q in connection.queries:
@Marakuba
Marakuba / calc6.py
Created November 2, 2015 12:29
calc6
# Token types
#
# EOF (end-of-file) token is used to indicate that
# there is no more input left for lexical analysis
INTEGER, PLUS, MINUS, MUL, DIV, LPAREN, RPAREN, EOF = (
'INTEGER', 'PLUS', 'MINUS', 'MUL', 'DIV', '(', ')', 'EOF'
)
class Token(object):
import reversion
from django.db import transaction
from ondelta.models import OnDeltaMixin
class MyModel(OnDeltaMixin):
""" """
def ondelta_all(self, fields_changed):
with transaction.atomic(), reversion.create_revision():
@Marakuba
Marakuba / FormRepo.js
Last active August 29, 2015 14:24 — forked from zaus/FormRepo.js
var FormRepo = function (namespace) {
/// <summary>Persistent form values, saves to localStorage</summary>
/// <param name="namespace" type="String">the namespace to store values in localStorage</param>
// should also protect per page, since we could have the same forms in various places
this.N = namespace + '.' + window.location.pathname;
};
$.extend(FormRepo.prototype, {
namespace: function (key) {
return this.N + '.' + key;
@Marakuba
Marakuba / index.html
Last active August 29, 2015 14:23 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
textarea {
width: 200px;
height: 200px;
# recursive_dictionary.py
# Created 2009-05-20 by Jannis Andrija Schnitzer.
#
# Copyright (c) 2009 Jannis Andrija Schnitzer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
// Ext.ux.panel.UploadPanel for ExtJs 4 + plupload
// Source: http://www.thomatechnik.de/webmaster-tools/extjs-plupload/
// Based on: http://www.sencha.com/forum/showthread.php?98033-Ext.ux.Plupload-Panel-Button-%28file-uploader%29
// Please link to this page if you find this extension usefull
// Version 0.2
// @authors:
// - mhd sulhan (ms@kilabit.org)
Ext.define ('Ext.ux.panel.UploadPanel',
{

Solution for Long Drop Down Items

Problem with long drop down menus? Well, try this simple solution with the use of javascript and jQuery.

A Pen by Larry Geams Parangan on CodePen.

License.

(function($) {
$.fn.msword_html_filter = function(options) {
var settings = $.extend( {}, options);
function word_filter(editor){
var content = editor.html();
// Word comments like conditional comments etc
content = content.replace(/<!--[\s\S]+?-->/gi, '');