Skip to content

Instantly share code, notes, and snippets.

@lechup
lechup / admin_changelist_overflow_fix.css
Last active August 29, 2015 14:02
too many columns in django admin for narrow resolution / overflow fix, just add the css in Your AdminModel Media css part...
#changelist-form > div.results, #changelist-form > div.results > #result_list
{
transform:rotateX(180deg);
-ms-transform:rotateX(180deg); /* IE 9 */
-webkit-transform:rotateX(180deg); /* Safari and Chrome */
}
#changelist-form > div.results {
overflow-x: auto;
}
from __future__ import absolute_import
import signal
import gevent
import gevent.pool
from rq import Worker
from rq.timeouts import BaseDeathPenalty, JobTimeoutException
from rq.worker import StopRequested, green, blue
from rq.exceptions import DequeueTimeout
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.contrib.sessions.backends.db import SessionStore as DjangoSessionStore
from django.db import migrations
from django.contrib.sessions.serializers import PickleSerializer, JSONSerializer
logger = logging.getLogger(__name__)
@lechup
lechup / ReflexVisibility.less
Created September 28, 2016 14:18
Responsive visibility utilities for reflex-grid
// Responsive visibility utilities
// reflex-grid
// based on Twitter bootstrap 4
// http://v4-alpha.getbootstrap.com/layout/responsive-utilities/#available-classes
@reflex-xs: 480px;
@reflex-sm: 768px;
@reflex-md: 992px;
@reflex-lg: 1200px;
@reflex-xlg: 1600px;
@media (min-width:480px){.hidden-xs-up{display:none!important}}@media (max-width:480px){.hidden-xs-down{display:none!important}}@media (min-width:768px){.hidden-sm-up{display:none!important}}@media (max-width:768px){.hidden-sm-down{display:none!important}}@media (min-width:992px){.hidden-md-up{display:none!important}}@media (max-width:992px){.hidden-md-down{display:none!important}}@media (min-width:1200px){.hidden-lg-up{display:none!important}}@media (max-width:1200px){.hidden-lg-down{display:none!important}}@media (min-width:1600px){.hidden-lgx-up{display:none!important}}@media (max-width:1600px){.hidden-lgx-down{display:none!important}}
@lechup
lechup / slugify.sql
Last active November 11, 2018 16:54 — forked from thomasbilk/slugify.sql
Pseudo Transliteration for Postgres aka `slugify`
CREATE OR REPLACE FUNCTION slugify(str text) RETURNS text AS $$
BEGIN
RETURN regexp_replace(
lower(translate(str,
'äëïöüáéíóúâêîûôåãõàèìòùřšěčůńýśćłęążźĄŃÝŚĆŁĘÄËÏÖÜÁÉÍÓÚÂÊÎÛÔÅÃÕÀÈÌÒÙŘŠĚČŮŻŹß ²ø®',
'aeiouaeiouaeiouaaoaeioursecunyscleazzANYSCLEAEIOUAEIOUAEIOUAAOAEIOURSECUZzs-2dR'
-- missing chars will be removed
)),
-- strip all others chars than [^a-z0-9 \-]
'[^a-z0-9 \-]',
@lechup
lechup / deploy.sh
Last active March 17, 2017 12:53
Simple deploy script, should be run from production, it uses screen to maintain connection in case of ssh failure + writes log to deploy.log and deploy.err.log
#!/bin/bash
# cleaning up sudo su "Cannot open your terminal" error
# http://serverfault.com/a/620149/63835
function screen() {
exec /usr/bin/script -q -c "/usr/bin/screen ${*}" /dev/null
}
# run inside screen
# http://unix.stackexchange.com/a/162150/53005
@lechup
lechup / MaterialUI.v.0.18.5.umd.min.js
Last active July 3, 2017 11:12
UMD MaterialUI version to use on jsfiddle, codepen etc., use it like: in here: https://jsfiddle.net/lechup/k52fdwm5
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.MaterialUI=t(require("React"),require("ReactDOM")):e.MaterialUI=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarTitle=t.ToolbarSeparator=t.ToolbarGroup=t.Toolbar=t.Toggle=t.TimePicker=t.TextField=t.TableRowColumn=t.TableRow=t.TableHeaderColumn=t.TableHeader=t.TableFooter=t.TableBody=t.Table=t.Tab=t.Tabs=t.Snackbar=t.Stepper=t.StepLabel=t.StepContent=t.StepButton=t.Step=t.SvgIcon=t.Subheader=t.Slider=t.SelectField=t.RefreshIndicator=t.RaisedButton=t.RadioButton
@lechup
lechup / Loader.js
Last active July 20, 2017 19:43
React Loader component with react-transition-group Transitions
import React from "react";
import PropTypes from 'prop-types';
import Transition from 'react-transition-group/Transition';
import loaderSrc from "../../img/utils/loader.gif";
import './loader.less'
class Loader extends React.Component {
inTransition = false;
@lechup
lechup / maintenance-mode-apache.md
Last active October 16, 2017 18:03 — forked from wataruoguchi/How to make your website to maintenance mode.md
How to make maintenance mode - Apache

Apache

How to make your website to maintenance mode

  1. Put maintenance.html into your root directory

  2. Open .htaccess file

  3. Insert this block in the first line of the file

     ErrorDocument 503 /maintenance.html
     RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
    

RewriteCond %{REQUEST_URI} !(/maintenance.html)