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
{% if not debug %} | |
<script> | |
var _gaq = window._gaq || []; | |
window.onerror = function(msg, url, line) { | |
var preventErrorAlert = true; | |
_gaq.push(['_trackEvent', 'JS Error', msg, '#{{ employee.id|default:"0" }} ip:{{ request.META.REMOTE_ADDR|escapejs }} ua:{{ request.META.HTTP_USER_AGENT|escapejs }} url:' + url + " line:" + line, 0, true]); | |
return preventErrorAlert; | |
}; | |
jQuery.error = function (message) { | |
_gaq.push(['_trackEvent', 'jQuery Error', message, '#{{ employee.id|default:"0" }} ip:{{ request.META.REMOTE_ADDR|escapejs }} ua:{{ request.META.HTTP_USER_AGENT|escapejs }}', 0, true]); |
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
/* | |
* Copyright (c) 2010 Tobias Schneider | |
* This script is freely distributable under the terms of the MIT license. | |
*/ | |
(function(){ | |
var UPC_SET = { | |
"3211": '0', | |
"2221": '1', | |
"2122": '2', |
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
{% macro form_open(form, action="", method="post", class="") -%} | |
<form role="form"{% if class %} class="{{ class }}"{% endif %}{% if action %} action="{{ action }}"{% endif %} method="{{ method|default("post") }}" {% if form.is_multipart() %}enctype="multipart/form-data" {% endif %}> | |
{%- for field in form.hidden_fields() -%} | |
{{ field|safe }} | |
{%- endfor -%} | |
{% endmacro %} | |
{% macro form_open_horizontal(form, action="", method="post") -%} | |
{{ form_open(form, action=action, method=method, class="form-horizontal") }} |
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
# _*_ coding: utf-8 _*_ | |
# http://xn--80aiqe1a.xn--p1ai/kladr.html | |
from django.db import models | |
class KladrManager(models.Manager): | |
def filter_state(self, code=None, actual=True, queryset=None): | |
if queryset is None: | |
queryset = self.get_query_set() | |
queryset = queryset.extra(where=["code LIKE %s"], params=["%000000000__"]) |
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 | |
from django.conf import settings | |
from pipeline.compilers import SubProcessCompiler | |
class LessCompiler(SubProcessCompiler): | |
output_extension = "css" | |
def match_file(self, filename): | |
return filename.endswith(".less") |
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
jQuery(function($){ | |
$(document).on("copy", function () { | |
var selection, html = ""; | |
if (window.getSelection || document.getSelection) { | |
selection = window.getSelection ? window.getSelection() : document.getSelection(); | |
if (selection.rangeCount) { | |
html = document.createElement("div"); | |
for (var i = 0, n = selection.rangeCount; i < n; ++i) { | |
html.appendChild(selection.getRangeAt(i).cloneContents()); |
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
<div class="input-group"> | |
<input class="form-control" id="id_password" name="password" required="required" type="password" value="" /> | |
<label class="input-group-addon" for="id_password" id="id_password_toggle"> | |
<i class="fa fa-eye-slash"></i> | |
</label> | |
</div> | |
<script> | |
jQuery(function($) { | |
var input = $("#id_password"); | |
$("#id_password_toggle").on("mousedown", 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
<?php | |
// This test script is designed to be run from the command line. | |
// It measures the subject string length that results in a | |
// PREG_RECURSION_LIMIT_ERROR error in the preg_match() function. | |
echo("Entering TEST.PHP...\n"); | |
// Set and display pcre.recursion_limit. (set to stacksize / 500). | |
// Under Win32 httpd.exe has a stack = 256KB and 8MB for php.exe. | |
//ini_set("pcre.recursion_limit", "524"); // Stacksize = 256KB. |
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 | |
// SEEMORE: http://stackoverflow.com/questions/7620910/regexp-in-preg-match-function-returning-browser-error | |
var_dump( | |
preg_match('/\\G"((?:[^"\\\\\\r\\n]|\\\\.|\\\\\\r\\n|\\\\[\\n\\r\\f])*)"|\'((?:[^\'\\\\\\r\\n]|\\\\.|\\\\\\r\\n|\\\\[\\n\\r\\f])*)\'/','.foo { | |
bar: \'/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\'; | |
}', $match, 0, 12) | |
); | |
var_dump($match); |
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
$.widget("ui.combobox", { | |
_create: function() { | |
var input, | |
self = this, | |
select = this.element.hide(), | |
selected = select.find(":selected"), | |
value = selected.val() ? selected.text() : "", | |
wrapper = this.wrapper = $("<span>").addClass("ui-combobox").insertAfter(select); | |
input = $("<input>") | |
.appendTo(wrapper) |
OlderNewer