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 | |
$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; |
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 re | |
class ValidationError(ValueError): | |
def __init__(self, message, code=None): | |
super(ValidationError, self).__init__(message) | |
self.code = code | |
def __str__(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
setInterval(function () { | |
var x = $('.post_copy .post_delete_button'); | |
if(x) | |
{ | |
x.click(); | |
x.remove(); | |
} | |
}, 500); | |
setInterval(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
[{"distance": "0.14 miles", "statezip": "New York, NY 10012", "name": "St. Anthonys School", "url": "http://www.greatschools.org/new-york/new-york-city/5320-St.-Anthonys-School/", "grade": "n/a", "address": "60 Mac Dougal Street", "type": "Private"}, {"distance": "0.17 miles", "statezip": "New York, NY 10013", "name": "Chelsea Career and Technical Education High School", "url": "http://www.greatschools.org/new-york/new-york-city/1948-Chelsea-Career-And-Technical-Education-High-School/", "grade": "9-12", "address": "131 Ave of the Americas", "type": "Public"}, {"distance": "0.17 miles", "statezip": "Manhattan, NY 10013", "name": "NYC Ischool", "url": "http://www.greatschools.org/new-york/manhattan/13270-NYC-Ischool/", "grade": "9-11", "address": "131 Ave of the Americas", "type": "Public"}, {"distance": "0.25 miles", "statezip": "New York, NY 10012", "name": "University Plaza Nursery School", "url": "http://pk.greatschools.org/new-york/new-york-city/preschools/University-Plaza-Nursery-School/11467/", "grade": |
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
/** | |
* 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). |
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
GcsManager | |
Robot | |
WitInterface | |
WitResponse | |
XmppReporter | |
cjson | |
cloudsql | |
cloudsql.beans | |
cloudsql.dao | |
cloudsql.dao.dialogdao |
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
find . -type d -name migrations -not -exec git check-ignore -q {} \; -exec git add {} \; |
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 os | |
import sys | |
import requests | |
import re | |
from json import loads | |
from HTMLParser import HTMLParser | |
import shutil | |
from lxml.html import fromstring | |
from time import sleep |
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 django.conf import settings | |
from django.utils import translation | |
class LocaleByDomainMiddleware(): | |
def process_request(self, request): | |
host = request.META['HTTP_HOST'].lower() | |
locales = dict(settings.LOCALE_DOMAINS) | |
if not host in locales: |
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 celery import shared_task | |
from celery.contrib.methods import task_method | |
from django.core.mail.backends.smtp import EmailBackend as BaseEmailBackend | |
class FakeLock(object): | |
__enter__ = lambda x: None | |
__exit__ = lambda a, b, c, d: None | |