Skip to content

Instantly share code, notes, and snippets.

View phpdude's full-sized avatar
🏠
Working from home

Alexandr Shurigin phpdude

🏠
Working from home
View GitHub Profile
@phpdude
phpdude / pre-commit
Created April 6, 2016 17:31 — forked from wolfhechel/pre-commit
Auto add Django migrations before commit
find . -type d -name migrations -not -exec git check-ignore -q {} \; -exec git add {} \;
@phpdude
phpdude / Result.example.log
Last active March 17, 2016 19:59
Find used python packages list needed to be installed (or used in requirements.txt)
GcsManager
Robot
WitInterface
WitResponse
XmppReporter
cjson
cloudsql
cloudsql.beans
cloudsql.dao
cloudsql.dao.dialogdao
@phpdude
phpdude / docker-compose.yml
Created March 9, 2016 15:27
Docker Composer Django \w NGINX \w uWSG \w PostgreSQL In Production
version: '2'
services:
db:
restart: always
image: postgres
environment:
- POSTGRES_USER=project
- POSTGRES_PASSWORD=project
volumes:
@phpdude
phpdude / wkhtmltopdf.tablesplit.js
Created January 17, 2016 16:03 — forked from niflostancu/wkhtmltopdf.tablesplit.js
WkHtmlToPdf Table Splitting Hack
/**
* WkHtmlToPdf table splitting hack.
*
* Script to automatically split multiple-pages-spanning HTML tables for PDF
* generation using webkit.
*
* To use, you must adjust pdfPage object's contents to reflect your PDF's
* page format.
* The tables you want to be automatically splitted when the page ends must
* have a class name of "splitForPrint" (can be changed).
@phpdude
phpdude / delete-reposts.js
Last active November 18, 2015 18:32
Delete reposts from vk.com profile wall.
setInterval(function () {
var x = $('.post_copy .post_delete_button');
if(x)
{
x.click();
x.remove();
}
}, 500);
setInterval(function() {
@phpdude
phpdude / validate_email.py
Created November 9, 2015 22:28
Validate Email Address in Python (part of django framework)
import re
class ValidationError(ValueError):
def __init__(self, message, code=None):
super(ValidationError, self).__init__(message)
self.code = code
def __str__(self):
@phpdude
phpdude / example.js
Last active June 9, 2018 20:14
PhantomJS: hellper for writing scripts waiting full page load (DOMContentLoaded event)
var system = require("system");
var url = system.args[1];
require('./phantom-full-load')(phantom, url, function (page, logs) {
logs.forEach(function (i) {
console.log('> ' + i);
});
result = page.evaluate(function () {
return $('body *').attr('class');
@phpdude
phpdude / gavnocode.php
Last active August 29, 2015 14:26
gavnocode.php
<?php
$query = $db->query("SELECT * FROM refer GROUP BY keyword ORDER BY date DESC LIMIT 0,10");
while($row = $db->get_row($query)){
preg_match_all('/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\/(.+?).html/', $row['url'], $request_out);
$first = mb_substr($row['keyword'],0,1); // первая буква
$last = mb_substr($row['keyword'],1); // все кроме первой буквы
$first = mb_strtoupper($first);
$last = mb_strtolower($last);
$keyword = $first.$last;
gulp = require 'gulp'
watchify = require 'watchify'
browserify = require 'browserify'
source = require 'vinyl-source-stream'
buffer = require 'vinyl-buffer'
gutil = require 'gulp-util'
assign = require 'lodash.assign'
rename = require 'rename'
EXTERNALS = [
@phpdude
phpdude / nginx.conf
Created April 13, 2015 01:38
Lifehack! Nginx proxy django static files with DEBUG=True.
location /static {
root /path/to/project/;
try_files $uri @django;
}